Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Calendar Program Write a program to design an appointment calendar. An appointment includes a description, date, starting time, and ending time. Supply a user interface

Calendar Program

Write a program to design an appointment calendar. An appointment includes a description, date, starting time, and ending time. Supply a user interface to add appointments, remove canceled appointments, and print out a list of appointments for a particular day. Appointments should not be duplicated for a given time and date.

Include a class AppointmentMenu to print the menu to the screen and accept user input. AppointmentMenu creates an AppointmentCalendar and then calls the appropriate methods to add, cancel, show, or quit.

Include a class AppointmentCalendar that is not coupled with the Scanner or PrintStream classes. (In other words, all println statements should be in AppointmentMenu.) AppointmentCalendar will include an arrayList of Appointments, a method to add Appointments, a method to cancel Appointments, and return the Appointments for a selected day.

Include a class Appointments which holds the input of description, date, and time. It should have a method to format the output for printing by the AppointmentMenu, a method to check to see if two appointments are equal so an appointment is not duplicated for a given date and time, and a method to check for a certain date when show and cancel are called.

Be sure to include any other methods including any accessor methods that you need to complete this program using the design process described in Chapter 12.

Your main class should be called AppointmentSystem. Use the code below:

/** A system to manage appointments. */ public class AppointmentSystem { public static void main(String[] args) { AppointmentMenu menu = new AppointmentMenu(); menu.run(); } } 

Here is a sample program run. (bold items are sample user inputs).

A)dd C)ancel S)how Q)uit A Appointment (Description Date From To) Dentist 01/10/2007 17:30 18:30  A)dd C)ancel S)how Q)uit A Appointment (Description Date From To) Sweets Cafe 01/10/2007 19:00 20:00  A)dd C)ancel S)how Q)uit A Appointment (Description Date From To) CS1 class 02/10/2007 08:30 10:00 A)dd C)ancel S)how Q)uit S Show appointments for which date? 01/10/2007 Appointments: Dentist 01/10/2007 17:30 18:30 Sweets Cafe 01/10/2007 19:00 20:00 A)dd C)ancel S)how Q)uit C Cancel appointments on which date? 01/10/2007 1) Dentist 01/10/2007 17:30 18:30 2) Sweets Cafe 01/10/2007 19:00 20:00 Which would you like to cancel? 1 A)dd C)ancel S)how Q)uit S Show appointments for which date? 01/10/2007 Appointments: Sweets Cafe 01/10/2007 19:00 20:00 A)dd C)ancel S)how Q)uit A Appointment (Description Date From To) Sweets Cafe 01/10/2007 19:00 20:00 This appointment already exists. A)dd C)ancel S)how Q)uit Q 

How do I write this program in JAVA not C++ ? Thanks

Also DON'T

import java.io.IOException;

import java.sql.SQLException;

I can only import the scanner class, and ArrayLists and Arrays

What I've done so far is

/** A system to manage appointments. */ public class AppointmentSystem { public static void main(String[] args) { AppointmentMenu menu = new AppointmentMenu(); menu.run(); } } import java.util.Scanner; public class AppointmentMenu extends AppointmentCalendar{ public void run(){ Scanner in = new Scanner(System.in); System.out.println("A)dd C)ancel S)how Q)uit"); String choice = in.nextLine(); { if (choice.equalsIgnoreCase("A")){ super.addApt(); System.out.println("Appointment(Description Date From To)"); } if (choice.equalsIgnoreCase("C")){ super.cancelApt(); System.out.println("Cancel appointments on which date?"); } if (choice.equalsIgnoreCase("S")){ super.showApt(); System.out.println("Show appointments for which date?"); } if (choice.equalsIgnoreCase("Q")) return; } } } import java.util.ArrayList; public class AppointmentCalendar extends Appointments{ private ArrayList appointments = new ArrayList(); public void addApt(){ } public void cancelApt(){ } public void showApt(){ } } import java.util.ArrayList; import java.util.Scanner; public class Appointments { private ArrayList description = new ArrayList(); private ArrayList dates = new ArrayList(); private ArrayList times = new ArrayList(); }

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_2

Step: 3

blur-text-image_3

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

Structured Search For Big Data From Keywords To Key-objects

Authors: Mikhail Gilula

1st Edition

012804652X, 9780128046524

More Books

Students also viewed these Databases questions