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

rules: All methods have Javadoc comments that fulfill all the requirements in th

ID: 3588480 • Letter: R

Question

rules:

All methods have Javadoc comments that fulfill all the requirements in the rules for programming. This includes all @param, @return, @throws, and Description sections.

Program should have consistent indentation

Program should have comments as needed

Program includes a superclass Appointment which includes a method occursOn.

Program includes a subclass Onetime with an occursOn method.

Program includes a subclass Daily with an occursOn method.

Program includes a subclass Monthly with an occursOn method.

Test Program fills an Array or ArrayList with an assortment of different types of appointments. Be sure to include more than one of each type. There should be a minimum of 10 Appointment objects

Allows the user to add appointments.

Be able to print out all appointments on a certain day

Included a test program to illustrate the entire Appointment Book application.

COP3337 Assignment 3 Write a program to implement an appointment book. Implement a superclass Appointment and subclasses Onetime, Daily, and Monthly. An appointment has a description (for example, "meet with accountant") 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. Allow the user to add new appointments. The user must specify the type of appointment, the description, and the date . Provide a main method to show the implementation of your appointment book, call it AppointmentBook.java Follow all directions in the COP3337 Class Rules for Submitting Programs Please use the file> export> to zip option in NetBeans. The zip file should be named FirstNameLastNameA3.zip.

Explanation / Answer

import java.util.Date;

public class Appointment {

private Date d = new Date();

private String desc;

Appointment(Date d, String desc){

this.d = d;

this.desc = desc;

}

public Date getD() {

return d;

}

public void setD(Date d) {

this.d = d;

}

public String getDesc() {

return desc;

}

public void setDesc(String desc) {

this.desc = desc;

}

public void occursOn(int year, int month, int date) {

if(this.d.getDay() == date && this.d.getYear() == year && this.d.getMonth() == month)

System.out.println("Appontment is fixed for today");

else

System.out.println("No Appointment for today!.");

}

}

import java.util.Date;

public class Daily extends Appointment{

Daily(Date d , String desc){

super(d, desc);

}

public void occursOn(int year, int month, int date) {

System.out.println("Your's daily Appointment is schedule."+" Appointment Desc: "+this.getDesc());

}

}

import java.util.Date;

public class OneTime extends Appointment {

OneTime(Date d , String desc){

super(d, desc);

}

public void occursOn(int year, int month, int date) {

if(this.getD().getDate() == date )

System.out.println("Your one time Appointment is scheduled for today. Appointment desc: "+ this.getDesc());

else

System.out.println("No Appointment is scheduled");

}

}

import java.util.Date;

public class Monthly extends Appointment{

Monthly(Date d, String desc){

super(d, desc);

}

public void occursOn(int year, int month, int date) {

if(this.getD().getMonth() == month && this.getD().getDate() == date)

System.out.println("Your Monthy Appointment has been schedued for today. Appointment Desc:"+this.getDesc());

else

System.out.println("No meeting is scheduled");

}

}