Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Department of Computer Science

OOP Spring 2021


Assignment - 01
Submission Date: 23-05-2021 (Sunday) 11:59PM

Objects and Classes


Consider the Digital Clock Example discussed in the class. You are provided with the code of
Digital Clock in the Lecture Slides or you may refer Chapter 3 of one the referred course Book
“Object First With Java –A Practical Introduction using BlueJ”.

The Given Code is currently dealing with a 24 Hours Clock. You have Change the Clock from 24-
hours to 12-hours Clock. In a 12-hour clock, the hours after midnight and after noon shall be shown
as 12:30 and not as 00:30. Thus, the minute display shows values from 0 to 59, while the hour
display shows values from1 to 12.

You are supposed to implement two version of the 12-hour clock as per requirement given in bold.

And after that you have to make a comparison about the implementation, which version is easier
and why?

One possibility is to store hour values from 1 to 12.

Secondly, you can simply leave the clock to work internally as a 24 hours clock but change
the display string of clock display to show 04:23PM when the internal value is 16:23.

Your clock display must look like this


04:15:23 PM
Where 04 is showing hour, 15 is showing minutes while 23 is showing seconds.
First Requirement is that whenever time is changed the old time must be dispose off (Clear from
screen) and then display new time. If you could not do the same then you may display new time
on next line.

Instruction:
This is individual assignment and you are supposed to work individually without help of any of
your peer. Any Part of your code is appeared to be copied from anywhere or any part of your code
if appeared somewhere else, no mark will be awarded,

You might also like