Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your task is to a write program named WeeklyCalendar that keeps track of all appointments. For this you will be writing several methods. Your program

Your task is to a write program named WeeklyCalendar that keeps track of all appointments. For this you will be writing several methods. Your program must have the following method.

readFromFile. This method read appointments from a file named myCalendar.txt. The format of the file is as described above. It returns an array list of Strings. Each word of the file myCalendar.txt will be an element of the array list. For example if the contents of the file are asdescribed above, then this method returns an array list (of Strings) of size 3. The string at index 0 is Monday@5PM, String at index 1 is Tuesday@2PM, and String at index 2 is Friday@6PM. From now we will refer to this list as appointment list.

hasAppointmentAt. This method takes three parameters with following names and types.

appointmentList. This is an array list of strings consisting of all appointments.

specifiedDay. Weekday.

specifiedTime. A string representing time. This of form hhAM or hhPM. For example, 9AM or 10PM. You may assume that minutes are not specified. The method searches the appointmentList for an appointment on specifiedDay at specifiedTime. If found, the method returns true. Otherwise, the method returns false.

addAppointment. This method takes three parameters with following names and types.

appointmentList. This is an array list of strings consisting of all appointments.

specifiedDay. Weekday.

specifiedTime. A string representing time. This of form hhAM or hhPM. For example, 9AM or 10PM. You may assume that minutes are not specified. The method first searches whether there is an existing appointment at specifiedTime on specifiedDay. If so, then this method returns false. Otherwise, this method adds an appointment to the appointmentList and returns true

removeAppointment. This method takes three parameters with following names and types.

appointmentList. This is an array list of strings consisting of all appointments.

specifiedDay. Weekday.

specifiedTime. A string representing time. This of form hhAM or hhPM. For example, 9AM or 10PM. You may assume that minutes are not specified. The method first searches whether there is an existing appointment a specifiedTime on specifiedDay. If so, then this method returns removes that appointment and returns true. Otherwise, this method returns false.

appointmentsOnDay. This method takes two parameters with following names and types.

appointmentList. This is an array list of strings representing all appointments.

specifiedDay. A string representing a week day. This method returns an array list (of Strings) consisting of all appointments on the

specifiedDay.

printAppointmentCalendar. This method takes a variable named appointmentList (which is an array list of Strings) representing all appointments. This prints the appointment onto the screen. Each line of the output starts with weekday followed by appointments on that day. Since there are seven weekdays, the output has 7 lines. An example output is as follows:

Monday: 2PM 8AM 3PM

Tuesday:

Wednesday: 11AM 12PM

Thursday: 2PM 8AM 11AM

Friday:

Saturday: 9AM 10AM 12PM 5PM 8PM

Sunday:

main. This is the main method. The main method first reads the appointments from a file named myCalendar.txt and stores them in an array list. Then it repeatedly prompts the user to enter one of add, remove, printDay, printAll or quit. When the user enters quit the program terminates.

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

Sample myCalendar.txt:

Monday@5PM

Tuesday@2PM

Friday@6PM

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

Expert Oracle9i Database Administration

Authors: Sam R. Alapati

1st Edition

1590590228, 978-1590590225

More Books

Students also viewed these Databases questions

Question

Describe the strategic planning process.

Answered: 1 week ago

Question

=+ how might this lead to faster growth in productivity?

Answered: 1 week ago