This Java program is a calendar scheduler that allows users to add, remove, list, and check appointments for each day of the year. It consists of three classes: Calendar
, Day
, and HandleInput
.
-
Calendar Class: This class is the main driver for the program. It creates an array of
Day
objects, one for each day of the year. It then uses a menu system to allow the user to interact with the calendar and perform various scheduling tasks. -
Day Class: This class represents a single day in the calendar. It contains two arrays: one to track whether each hour of the day is scheduled
isBusy
, and another to store the description of the appointment for each hourappointmentDescription
. The class provides methods to check if an appointment exists for a specific hour, add an appointment, remove an appointment, and get a string representation of the appointments for the day. -
DisplayMonth Class This class is designed to display a monthly calendar based on user input for the day of the week and its corresponding month. It initializes a
Scanner
object for user input and creates arrays for the days of the weekdays
and months of the yearmonths
. The class prompts the user to input the day of the week and month they want to display, validates the input, and calculates the number of days in the selected month, considering leap years for February. It then displays the selected month's name, the days of the week, and the days of the month in a calendar format, starting with the correct day of the week based on the user's input. Finally, the class closes theScanner
object. -
HandleInput Class: This class contains static methods to handle user input. It provides methods to get a menu selection, get an appointment description, get a day, and get an hour. It also includes methods to verify if a day or hour value is valid.
The program uses a Scanner
object to read user input from the console and utilizes a menu-driven interface to allow users to interact with the calendar. The DisplayMonth
class is not directly related to the calendar scheduling functionality but is used to display a monthly calendar based on user input for the day of the week and month.