CSC 172 - Introduction to Algorithms and Data Structures

Dr. R. M. Siegfried

Assignment #5 - Writing An Immutable Class For Time

Due Friday, February 21, 2014

An immutable class is a class that has no mutators, so there is no way to change private properties. The way in which these are written and are used is a little bit different.

You are going to write a class called Time that has three private properties:

Both minutes and seconds have the usual meaning.

Your class will have 4 constructors:

Additionally write the following methods:

Write another class containing a main program that creates a Time object, and returns the time 4 hours, 27 minutes and 15 seconds later.

[Back to the Assignment Index]