Question
Java Create a class named Appointment that stores information about appointments. All times are military or 24 hour times. So 1:00 am is 100, and
Java
Create a class named Appointment that stores information about appointments. All times are military or 24 hour times. So 1:00 am is 100, and 1:00pm is 1300. The class must ensure that startTime and endTime instance variables are within the valid range of times (0 2359). If an invalid time is passed to the object, assign the time to -1 and print the following error message: Invalid time: the time must be between 0 and 2359.
Create a class named AppointmentTester that tests the Appointment class created in the previous question. The code must contain a main method and perform the following.
Create an object using the default constructor.
Create an object using the parameterized constructor.
Call both mutator methods.
Call the accessor method and printout that value.
Call the toString method and printout that value.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started