Your SlideShare is downloading. ×
Object Oriented Programming – Spring 2011                       Engr. Anwar, Foundation University (FUIEMS), Islamabad    ...
Upcoming SlideShare
Loading in...5
×

oop Lecture 9

172

Published on

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
172
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "oop Lecture 9"

  1. 1. Object Oriented Programming – Spring 2011 Engr. Anwar, Foundation University (FUIEMS), Islamabad Quiz 1 [10 Marks] Time allowed: 20 MinutesQuestion: Create a class called Time. The purpose of this class is to print time in two different formatsmilitary 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. SecondsAnd 4 methods (behavior) 1. Time (Constructor Function) 2. setTime 3. printMilitary 4. printStandardThe input to program is optional i.e. it can be from user or already specified in your program. Youprogram should handle all wrong input conditions. Explain your program.

×