Define a derived class alarmclock to represent an alarm


Please help me with the java Programming Snippets

1. Define a derived class, AlarmClock, to represent an alarm clock, with the following Clock class as its base class.

public class Clock {

private int hour;

private int minute;

private int second;

//default constructor

public Clock() {

//initialize to default values

hour = 0;

minute = 0;

second = 0;

}

//constructor with arguments

public Clock(int h, int m, int s) //set current time

{

hour = h;

minute = m;

second = s;

}

...

}

In your AlarmClock subclass, you only need to consider the following two aspects:

The AlarmClock should have three instance variables: alarmHour, alarmMinute, and alarmSecond.

Please write two constructors of the derived class AlarmClock -- one is the default constructor that assigns all member/instance variables to zero. The other takes 6 arguments time (ie., hour, minute, second, alarmHour, alarmMinute, alarmMinute.) that sets current time and alarm

(no need to write any other methods)

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Define a derived class alarmclock to represent an alarm
Reference No:- TGS02889510

Expected delivery within 24 Hours