Instructions:
Appointment Checker – HW 04
1. Declare a class called Appointment which has
Fields:
1.
· String title
· int day, month, yea
Methods:
· public boolean occursOn(int day, int month, int year) - which returns true if the parameters match the appointment’s day month and yea
· public string toString() - displays the appointment
· a constructor with a day, month, year and title and a no-args constructor.
2. Create subclasses of Appointment called SingleAppointment, DailyAppointment, MonthlyAppointment, and YearlyAppointment. Ove
ide the occursOn(), toString(), and the constructor methods in each appropriately. For example the constructor for a YearlyAppointment only needs to specify a day, a month and a title. A DailyAppointment only needs a title.
3. File an a
ay of Appointment type with a variety of the Appointment subclasses. You will have to keep track of how many items are stored in the a
ay with a counter. For example:
final int MAX_APPOINTMENTS=100;
Appointment app[] = new Appointment[MAX_APPOINTMENTS];
int count=0;
app[count++]=new DailyAppoin
tment("Code");
app[count++]=new DailyAppointment("Eat");
app[count++]=new DailyAppointment("Sleep");
app[count++]=new MonthlyAppointment(15,"Get Haircut");
app[count++]=new MonthlyAppointment(1,"Pay Day");
app[count++]=new YearlyAppointment(15,4,"Tax Day");
app[count++]=new YearlyAppointment(1,1,"New Year's Day");
app[count++]=new SingleAppointment(9,5,2020, "Commencement");
app[count++]=new SingleAppointment(16,3,2020, "Start of Spring Break");
app[count++]=new SingleAppointment(18,3,2019, "Start of Spring Break");
4. Display all the Appointments in the system
5. Prompt and read from the user for a specific day, month and yea
6. Display all the appointments which match that date.
Sample Run 1: (user input shown in BOLD ITALICS)
Daily: Code
Daily: Eat
Daily: Sleep
Monthly [15] Get Haircut
Monthly [1] Pay Day
Yearly [15/4] Tax Day
Yearly [1/1] New Year's Day
Single [5/9/2020] Commencement
Single [3/16/2020] Start of Spring Break
Single [3/18/2019] Start of Spring Break
Enter a specific day month year separated by spaces. Example: XXXXXXXXXX
XXXXXXXXXX
========================================
Daily: Code
Daily: Eat
Daily: Sleep
Monthly [1] Pay Day
Yearly [1/1] New Year's Day
Sample Run 2
Daily: Code
Daily: Eat
Daily: Sleep
Monthly [15] Get Haircut
Monthly [1] Pay Day
Yearly [15/4] Tax Day
Yearly [1/1] New Year's Day
Single [5/9/2020] Commencement
Single [3/16/2020] Start of Spring Break
Single [3/18/2019] Start of Spring Break
Enter a specific day month year separated by spaces. Example: XXXXXXXXXX
XXXXXXXXXX
========================================
Daily: Code
Daily: Eat
Daily: Sleep
Single [5/9/2020] Commencement