Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A. Implement a superclass called Appointment and subclasses OneTime, Daily, Week

ID: 3534599 • Letter: A

Question

A. Implement a superclass called Appointment and subclasses OneTime, Daily, Weekly, and Monthly. An Appointment has a description (for example, “Meet with interviewer about jobâ€) and a date and time. Write a method occursOn(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then, in a TestAppointment class, fill an array of Appointment objects with a mixture of different kinds of appointments. Ask a user to enter a date and print out all appointments that occur on that date.

B. Improve your Appointment program by giving the user the option to add new Appointments. The user must specify the type of the appointment, the description, and the date and time.

Explanation / Answer

public Appointment findDate( String date ) {

if( this.date = date )

return this;


return null;

}

public Appointment findDesc( String description ) {

if( this.description = description )

return this;


return null;

}


TestAppointment has a datastore, such as ArrayList<Appointment> alist = ArrayList<Appointment>(). You go through that alist


Appointment detail = null;

for( Appointment a : alist ) {

if( a.description( "dentist" ) != null )

detail = a;

break;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote