object oriented programming
posted by sara .
We want to define a class clockType, to implement the time of day in a program. The time is represented as a set of three integers: one to represent the hours, one to represent the minutes, and one to represent the seconds. We also want to perform the following operations on the time:
1. Set the time to secs = 0, mins = 0, and hrs = 0 implicitly when an object of type clockType is declared
2. Set the time to a specific value
3. Print the time
4. Increment the time by one second
5. Increment the time by one minute
6. Increment the time by one hour
1. Write the definition of the class clockType including the definition of the different methods.
2. Write a main program to test the various operations of the class clockType.
So you'll need to define a class, with three instance variables, declared private and of type int.
You will need a default constructor to set the time to 0/0/0.
toString() method if you're using Java, or an equivalent method to print the time.
Three methods to increment the hour/minute/seconds respectively.
Then you'll be ready to design the main program to test the class methods.