Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Appointment Checker Declare a class called Appointment which has Fields: String title int day, month, year Methods: public boolean occursOn(int day, int month, int year)

Appointment Checker

  1. Declare a class called Appointment which has

Fields:

  1. String title
  2. int day, month, year

Methods:

  • public boolean occursOn(int day, int month, int year) - which returns true if the parameters match the appointments day month and year
  • public string toString() - displays the appointment
  • a constructor with a day, month, year and title and a no-args constructor.
  1. Create subclasses of Appointment called SingleAppointment, DailyAppointment, MonthlyAppointment, and YearlyAppointment. Override the occursOn(), toString(), and the constructor methods in each appropriately. For example the constructor for a YearlyAppointment only needs to specify a day, a month and a title. A DailyAppointment only needs a title.
  2. File an array of Appointment type with a variety of the Appointment subclasses. You will have to keep track of how many items are stored in the array with a counter. For example:

final int MAX_APPOINTMENTS=100;

Appointment app[] = new Appointment[MAX_APPOINTMENTS];

int count=0;

app[count++]=new DailyAppoin

tment("Code");

app[count++]=new DailyAppointment("Eat");

app[count++]=new DailyAppointment("Sleep");

app[count++]=new MonthlyAppointment(15,"Get Haircut");

app[count++]=new MonthlyAppointment(1,"Pay Day");

app[count++]=new YearlyAppointment(15,4,"Tax Day");

app[count++]=new YearlyAppointment(1,1,"New Year's Day");

app[count++]=new SingleAppointment(9,5,2020, "Commencement");

app[count++]=new SingleAppointment(16,3,2020, "Start of Spring Break");

app[count++]=new SingleAppointment(18,3,2019, "Start of Spring Break");

  1. Display all the Appointments in the system
  2. Prompt and read from the user for a specific day, month and year
  3. Display all the appointments which match that date.

Sample Run 1: (user input shown in BOLD ITALICS)

Daily: Code

Daily: Eat

Daily: Sleep

Monthly [15] Get Haircut

Monthly [1] Pay Day

Yearly [15/4] Tax Day

Yearly [1/1] New Year's Day

Single [5/9/2020] Commencement

Single [3/16/2020] Start of Spring Break

Single [3/18/2019] Start of Spring Break

Enter a specific day month year separated by spaces. Example: 1 15 2020

1 1 2020

========================================

Daily: Code

Daily: Eat

Daily: Sleep

Monthly [1] Pay Day

Yearly [1/1] New Year's Day

Sample Run 2

Daily: Code

Daily: Eat

Daily: Sleep

Monthly [15] Get Haircut

Monthly [1] Pay Day

Yearly [15/4] Tax Day

Yearly [1/1] New Year's Day

Single [5/9/2020] Commencement

Single [3/16/2020] Start of Spring Break

Single [3/18/2019] Start of Spring Break

Enter a specific day month year separated by spaces. Example: 1 15 2020

9 5 2020

========================================

Daily: Code

Daily: Eat

Daily: Sleep

Single [5/9/2020] Commencement

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts International Edition

Authors: David M. Kroenke

6th Edition International Edition

0133098222, 978-0133098228

More Books

Students also viewed these Databases questions

Question

3. Identify challenges to good listening and their remedies

Answered: 1 week ago

Question

4. Identify ethical factors in the listening process

Answered: 1 week ago