Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(JAVA PROGRAMMING) I provided the skeleton below. there is lots of code that needs changing. And comments are needed. Please use scanner Keyboard instead of

(JAVA PROGRAMMING)

I provided the skeleton below. there is lots of code that needs changing. And comments are needed. Please use scanner Keyboard instead of Scanner Sc. I will provide the classes below. There is a (DailyAppointment, MonthlyAppointment, OneTimeAppointment, Appointment, AppointmentsApp)

Read the attached instructions image text in transcribedon the Appointment hierarchy and tester class. Then, decide what is the best design for the hierarchy, deliberately selecting the best place to define your instance variables, corresponding getters & setters, and the polymorphic method public boolean occursOn(int year, int month, int day).

This assignment is menu driven and has 2 parts. The first part is when the user is asked to create different types of appointments . The second part is when the user is asked to provide a date so that all of his/her appointments that occur on that date will be listed.

Allow the creation of appointments only once, at the beginning of the program. Ensure the appointments are created before allowing users to check the calendar for appointments created on a specific date.

INSTRUCTIONS

In the driver class:

Code 2 methods:

1. Make Appointments - Fills an array of Appointment objects, with a mixture of appointments and dates and times.

2. Check Appointments - Asks the user to enter a specific date, and print out all the appointments that occur on that date.

Make sure you implement the polymorphic method occursOn() that can be called by any of the objects in the Appointment array.

A sample of the output of the program is as follows:

How many appointments do you wish to make? 3 Please make a selection: 1. One Time Appointment 2. Daily Appointment 3. Monthly Appointment 1 What is the description of your appointment? Dentist Checkup

What is your persons name? Dr. Smith

What year is your appointment? (2017 - 2018) 2017

What month is your appointment? (1 - 12) 03

What day is your appointment? (1 - 31) 15

What is the hour of your appointment? (00 23) 13

What is the minutes of your appointment? (00 59) 30

Appointment added with Dr.Smith on 03/15/2017 at 13:30

Please make a selection: 1. One Time Appointment 2. Daily Appointment 3. Monthly Appointment -----------------------------------------------

2 What is the description of your appointment? Athletic Training

What is your persons name? Ms. Jones

What is the hour of your appointment? (00 -23) 10

What is the minutes of your appointment? (00 -59) 00

Appointment added with Ms. Jones Daily at 10:00

Please make a selection: 1. One Time Appointment 2. Daily Appointment 3. Monthly Appointment

------------------------------------------------

3 What is the description of your appointment? Piano Lessons

What is your persons name? Ms. Katie

What day of the month is your appointment? (1 - 31) 15

What is the hour of your appointment? (00 -23) 17

What is the minutes of your appointment? (00 -59) 30

Appointment added with Ms. Katie Monthly on day 15 at 17:30

*************Thank you for making all of your appointments.***************** Loop with the following: What is the date you wish to look up in your Appointments' Calendar? Enter the month: 03 Enter the day: 15 Enter the year: 2017 On 3 / 15 / 2017 you have the following appointments: Dentist appointment with Dr. Smith at 13:30 Piano Lessons with Ms. Katie at 17:30 Athletic Training with Ms. Jones at 10:00 Do you wish to look up another date?

(If they answer NO, exit the program with message) Thank you for using your appointment calendar. (If they answer YES, continue to ask for another date to look up). What is the date you wish to look up in your Appointments' Calendar? Etc.

HINT: Try to use the hierarchy of .toString(), so that each level returns a specific string of values available at that level only.

Extra Credit:

Validate that the hour of time and date of a proposed appointment do not conflict with an appointment that is already in the array of appointments. If there is a conflict, as user to select another date or time, and validate again.

SKELETON Driver class (AppointmentsApp) -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

package appointmentsapp;

/** * * @author Cristy */ public class AppointmentsApp { public Appointment[] myAppointments; public int currentSize = 0; /** * @param args the command line arguments */ public static void main(String[] args) { AppointmentsApp myApp = new AppointmentsApp(); //call 2 methods: // myApp.makeAppointments(); // myApp.checkAppointments();

} //In the makeAppointments method, do the following: /** * * * How many appointments do you wish to make? 3 * * Use the number entered by user to instantiate the array of appointments to that size. * * Create a menu for-loop as follows: Please make a selection: 1. One Time Appointment 2. Daily Appointment 3. Monthly Appointment * * For Each option, call a specific method that will request the appropriate data from the user, * and then instantiate the appropriate class/subclass in the Appointment hierarchy * For each appointment made, you will add it to the global array of appointments at the currentSize, * and increment a currentSize global variable that keeps track of the next empty slot in the array. * * * * * //In the checkAppointments method, do the following: * Inside a do-while loop, ask the user the following questions: * What is the date you wish to look up in your Appointments' Calendar? Enter the month: 03 Enter the day: 15 Enter the year: 2017 * (Display the result in the following format:) * * On 3 / 15 / 2017 you have the following appointments: Dentist appointment with Dr. Smith at 13:30 Piano Lessons with Ms. Katie at 17:30 Athletic Training with Ms. Jones at 10:00

Do you wish to look up another date? (If they answer NO, exit the program with message) Thank you for using your appointment calendar.

(If they answer YES, continue to loop.

*/ } }

Appointment Class ----------------------------------------------------------------------------------------------------------------------------

package appointmentsapp;

/** * * @author Cristy */ public class Appointment { }

DailyAppointment Class -------------------------------------------------------------------------------------------------------------------------------------------

package appointmentsapp;

/** * * @author Cristy */ public class DailyAppointment { }

MonthlyAppointment class ---------------------------------------------------------------------------------------------------------------------------------------

package appointmentsapp;

/** * * @author Cristy */ public class MonthlyAppointment { }

OneTimeAppointment -------------------------------------------------------------------------------------------------------------------------------------------

package appointmentsapp;

/** * * @author Cristy */ public class OneTimeAppointment { }

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 Processing

Authors: David J. Auer David M. Kroenke

13th Edition

B01366W6DS, 978-0133058352

More Books

Students also viewed these Databases questions