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

Java problem with 2 parts: a.Implement a superclass Appointment and subclasses O

ID: 3771795 • Letter: J

Question

Java problem with 2 parts:

a.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 on that date. For Example, for a monthly appointment, you must check whether the day of the month matches. Then fill an array of Appointment objects with a mixture of appointments. Have the user enter a date and print out all appointments that occur on that date.

b.Improve the appointment book program by letting the user save the appointment data to a file and reload the data from a file. The saving part is straightforward: Make a method save. Save the type, description, and date to a file. The loading part is not so easy. First determine the type of the appointment to be loaded, create an object of that type, and then call a load method to load the data.

Thank you for help!

Explanation / Answer

import java.util.Calendar; import java.util.GregorianCalendar; /** Weekly appointment */ public class Weekly extends Appointment { /** Initializes appointment for a given date @param year the year @param month the month @param day the day @param description the text description of the appointment */ public Weekly(int year, int month, int day, String description) { super(year, month, day, description); } /** Determines if the appointment occurs on the same weekday @param year the year @param month the month @param day the day @return true if day matches the base appointment weekdate date and is later than the base appointment */ public boolean occursOn(int year, int month, int day) { if (year
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