Question: using Java You will put into action an Appointment class that interacts with the menu-driven application, called ApptMenu. There will be four fields in the


You will put into action an Appointment class that interacts with the menu-driven application, called ApptMenu. There will be four fields in the Appointment class: a title, a date, a beginning time, and an ending time. It is safe to predict that no appointment will last more than one day. Use LocalDate, LocalTime, and LocalDateTime. For the date field, use LocaIDate, and for the two time fields, use LocalTime. Here are the methods you will need in your Appointment class. r create an appointment public Appointment(LocalTime startTime, String titie, LocalTime endTime, LocalDate date) If getter methods public LocaiTime getStartTime() public String getTitle() public LocalTime getEndTime() public LocalDate getDate() Vireturns the start time formatted to display a 12 hour format. Wfor example, 04:31:00 AM If @return public String getStartTimeFormatted() Wreturn the end time formatted to display a 12 hour format II for example, 03:45:00 PM II @ return a formatted string It public String getEndTimeFormatted() Vireturns the day of the week based on the date. For example, an appointment on Feb 17, 2023 U. will return FRIDAY II @return a formatted string public String getDayonweek() returns the duration of the meeting in minutes, based on the start and end times public long howLonglnMinutes() IV returns true if the current appointment is longer or equal to the appointment passed in as a parameter N @param the appointment to compare to N igretum true or false public Boolean isLonger(Appointment other) W returns true if the current appointment starts before the appointment II passed in the parameter. This is based on both the date and the start time, W i.e., an appointment on Jan 12023 at 4:30pm occurs before an appointment N on Feb 72010 at 09:00 am. II @param the appointment to compare to it casetum true or false public Boolean isBefore(Appointment other) Output: Welcome to Appointment world Here are your options 1. Create two appointments 2: Display the days of the week the appointments are scheduled for 3: Display the appointments in order of occurrence 4: Display the longer appointment 0: exit Enter your choice 4 Exception in thread "main" java,lang. Null PointerException: Cannot invoke "Appointment.isLonger(Appointment)" because "appt1" is null at ApptMenu.displayLonger Appt(ApptMenu.java:45) at ApptMenu.main(ApptMenu.java:27)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
