Implement a superclass Appointment and subclasses Onetime, Daily, and Monthly.  An appointment has a description (for example, “see the dentist”) and a date (use int's to store the 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.  Additionally, you will need to implement a class called Calendar.  This will contain an ArrayList of Appointment objects (The list is an instance variable of the Calendar class).  You will need to provide the following methods for your Calendar class.   A no argument constructor   public Calendar(){...}   This constructor will initialize your ArrayList instance variable to an empty list.   /** * A method to add an appointment to the calendar * @param apt – the appointment object to add to the calendar. */ public void add(Appointment apt) {…}   /** * A method to remove an appointment from the calendar. * This method uses the occursOn() method from the public * interface for the Appointment class.  Therefore, if parameters * are entered that occur after a start date for a given Daily  * appointment * the Daily appointment will be removed as well.  (Because occursOn() * willreturn true in this case).  This is a limitation we will * accept for now. * @param year - the year of the appointment to remove * @param month - the month of the appointment to remove * @param day - the day of the appointment to remove */ public void remove(int year, int month, int day) { //this method needs to iterate over your list of appointments //and remove elements who's occursOn() method return true //when passed the parameters above. } /** * Method to return a string representation of this Calendar object. * Overrides the Object method toString * @return a String representation of the Calendar object. */ public String toString() { String ret = ""; //this method needs to iterate over your list of appointments //and construct the return string //make sure to put each appointment on its own line //by using “\n”   return ret; }   My question is: I am unable to add any items into the ArrayList. The error I'm recieving says that the type is not applicable for the arguements. Arrays are very confusing to me, so I'm sure there is something I am missing, but I've tried changing the type of the input to string before adding it to the list and nothing seems to be working. What am I doing wrong?

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Implement a superclass Appointment and subclasses Onetime, Daily, and Monthly.  An appointment has a description (for example, “see the dentist”) and a date (use int's to store the 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. 

Additionally, you will need to implement a class called Calendar.  This will contain an ArrayList of Appointment objects (The list is an instance variable of the Calendar class).  You will need to provide the following methods for your Calendar class.

 

A no argument constructor

 

public Calendar(){...}

 

This constructor will initialize your ArrayList instance variable to an empty list.

 

/**

* A method to add an appointment to the calendar

@param apt – the appointment object to add to the calendar.

*/

public void add(Appointment apt) {…}

 

/**

* A method to remove an appointment from the calendar.

* This method uses the occursOn() method from the public

* interface for the Appointment class.  Therefore, if parameters

* are entered that occur after a start date for a given Daily 

* appointment

* the Daily appointment will be removed as well.  (Because occursOn() * willreturn true in this case).  This is a limitation we will

* accept for now.

@param year - the year of the appointment to remove

@param month - the month of the appointment to remove

@param day - the day of the appointment to remove

*/

public void remove(int year, int month, int day) {

//this method needs to iterate over your list of appointments

//and remove elements who's occursOn() method return true

//when passed the parameters above.

}

/**

* Method to return a string representation of this Calendar object.

* Overrides the Object method toString

@return a String representation of the Calendar object.

*/

public String toString() {

String ret = "";

//this method needs to iterate over your list of appointments

//and construct the return string

//make sure to put each appointment on its own line

//by using “\n”

 

return ret;

}

 

My question is: I am unable to add any items into the ArrayList. The error I'm recieving says that the type is not applicable for the arguements. Arrays are very confusing to me, so I'm sure there is something I am missing, but I've tried changing the type of the input to string before adding it to the list and nothing seems to be working. What am I doing wrong?

 

This is an adaptation off of Big Java 6th edition Practice probem P9.3

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Developing computer interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education