Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Write a description of class Alarm here.
- *
- * @author Francois Argent
- * @version 1.0
- */
- public class Alarm
- {
- private ClockDisplay12 time;
- private boolean isSet = false;
- /**
- * Creates a new Alarm object, with a default time of
- * 12:00 a.m. with the alarm off.
- */
- public Alarm()
- {
- time = new ClockDisplay12();
- }
- /**
- * Creates a new Alarm object with a specified time.
- */
- public Alarm(int hour, int minute, String amPm, boolean set)
- {
- time = new ClockDisplay12(hour, minute, amPm);
- isSet = set;
- }
- /**
- * Sets the clock's time to another specified time.
- */
- public void setTime(int hour, int minute, String amOrPm)
- {
- time.setTime(hour, minute, amOrPm);
- }
- /**
- * Turns on the alarm.
- */
- public void turnOn()
- {
- isSet = true;
- }
- /**
- * Turns off the alarm.
- */
- public void turnOff()
- {
- isSet = false;
- }
- /**
- * Returns the current time on the clock.
- */
- public String getTime()
- {
- return time.getTime();
- }
- /**
- * Returns true if the alarm is set, false if it isn't set.
- */
- public boolean isSet()
- {
- return isSet;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement