1. Object Oriented Programming – Spring 2011
Engr. Anwar, Foundation University (FUIEMS), Islamabad
Quiz 1 [10 Marks]
Time allowed: 20 Minutes
Question: Create a class called Time. The purpose of this class is to print time in two different formats
military format and standard format.
Example of military format is: 13: 27 (13 being hour and 27 being minutes)
Example of standard format is: 1: 27:06 PM (1 being hour, 27 being minutes and 06 being seconds)
Your class should have at least 3 integer type attributes:
1. Hour
2. Minutes
3. Seconds
And 4 methods (behavior)
1. Time (Constructor Function)
2. setTime
3. printMilitary
4. printStandard
The input to program is optional i.e. it can be from user or already specified in your program. You
program should handle all wrong input conditions. Explain your program.