i have a skeleton class and i have to fill some methods of thisclass. i am having difficulties especially with the findAppointmentmethod. so this is the problem.
Implement a superclass Appointment and subclasses OneTime,Daily, and Monthly. An Appointment has a description (for example“see the dentistâ€) and a date. Write a method occursOn(int year,int month, int day) that checks whether the appointment occurs onthat date. For example, for a monthly appointment, you must checkwhether the day of the month matches.   You must write: •Appointment.java • Daily.java • Monthly.java • OneTime.java
You need to write AppointmentBook.java file – a skeleton and asample run of the program is given to you. This file has a mainmethod
I have done all the first part. the appointment, monthly, daily,OneTime. they work fine. the appointmentBook i havent finished.here is the skeleton. please use ArrayList and i want it injava.
**************AppointmentBook******************.
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/**
Build on the Appointment hierarchy.
Give the user the option to add new appointments.
The user must specify the type of the appointment and
description, and then, if required, the day or date.
*/
public class AppointmentBook
{ ................ }
/**
Adds a new Appointment object based on user input.
@param in the Scanner to read from.
*/
public void addAppointment(Scanner in)
{ ......................
}
/**
Method to print all appointments on a certain date.
@param in the Scanner to read from.
*/ public void findAppointments(Scanner in)
{ .....................}
// Just to test the appointment book
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
AppointmentBook ab = new AppointmentBook();
System.out.println(\"Welcome to the Appointment Book\");
System.out.println(\"-------------------------------\");
boolean done = false;
while (!done)
{
System.out.print(\"Appointments: (F)ind, (A)dd, or (Q)uit: \");
String choice = in.next();
if (choice.equals(\"F\") || choice.equals(\"f\"))
{
ab.findAppointments(new Scanner(System.in));
}
else if (choice.equals(\"A\") || choice.equals(\"a\"))
{
ab.addAppointment(new Scanner(System.in));
}
done = choice.equals(\"Q\") || choice.equals(\"q\");
}
System.out.println(\"Good bye. Have a nice day!\");
in.close();
}
}
***********this is the output*********
Welcome to the Appointment Book
-------------------------------
Appointments: (F)ind, (A)dd, or (Q)uit: A
Enter type [(D)aily, (M)onthly, (O)netime] and description: DExercise
Appointments: (F)ind, (A)dd, or (Q)uit: A
Enter type [(D)aily, (M)onthly, (O)netime] and description: D Eatdinner
Appointments: (F)ind, (A)dd, or (Q)uit: A
Enter type [(D)aily, (M)onthly, (O)netime] and description: M PayBills
Enter the day of the appointment: 1
Appointments: (F)ind, (A)dd, or (Q)uit: A
Enter type [(D)aily, (M)onthly, (O)netime] and description: M PayRent
Enter the day of the appointment: 10
Appointments: (F)ind, (A)dd, or (Q)uit: A
Enter type [(D)aily, (M)onthly, (O)netime] and description: O VisitPatagonia
Enter the date of the appointment (mm dd yyyy) : 12 01 2020
Appointments: (F)ind, (A)dd, or (Q)uit: a
Enter type [(D)aily, (M)onthly, (O)netime] and description: O VisitNorway
Enter the date of the appointment (mm dd yyyy) : 07 01 2020
Appointments: (F)ind, (A)dd, or (Q)uit: F
Enter the date (mm, dd, yyyy) to search: 09 10 2019
Exercise
Eat dinner
Pay Rent
Appointments: (F)ind, (A)dd, or (Q)uit: F
Enter the date (mm, dd, yyyy) to search: 07 01 2020
Exercise
Eat dinner
Pay Bills
Visit Norway
Appointments: (F)ind, (A)dd, or (Q)uit: f
Enter the date (mm, dd, yyyy) to search: 12 01 2020
Exercise
Eat dinner
Pay Bills
Visit Patagonia
Appointments: (F)ind, (A)dd, or (Q)uit: q
Good bye. Have a nice day!