1. Implement a class named Appointment that contains: • A private String data field named patientName. A private static int data field named newID. This value will be automatically incremented with the creation of each Appointement object. The initial value of newlD is 1. • A private constant (final) int data field named APPOINTEMENT_ID. • A private int data field named day. The value represents the day of the week from 1 to 5, (1 for Monday, 2 for Tuesday, and so on till Friday). • A private int data field named hour. Accepted values are 8, 9, 10, ...14 • A constructor that creates a new appointment with specific patient Name given as argument. Then, the appointment will be immediately assigned a APPOINTEMENT_ID according to newID. • The accessor (getter) methods for patientName and APPOINTEMENT_ID. • The accessor and mutator (setter) methods for the day and hour fields. Note that if the day value is not in [1,5] then the field is set 0. Also, if the hour is not in [8,14], the field value is set to 0. • The method getDayOfTheWeek returns a string representing the day of the week. For instance, if the day is 1, the method returns "Monday". If the day is 2, it returns "Tuesday" and so on. If the day is 0, the method returns "Undefined". • The method getApprointmentDetails that returns a string representation of the approintment. It contains the appointment ID, the patientName followed by a dash followed by the day of the week and the hour. For example: Appointment #1: The patient is HassanMohana - Monday at 10 o'clock. Write a main program to: - Create two different appointment. The first appointment object is for patient "MayaMrouch" on “Thursday" at “13 pm". The second appointment object is read from the user. Write the code to check if the two appointments conflict in day and time. If so it prints a message "The two appointments are set for the same day and day". And moves one of the appointments to the next day. Write the code to display the appointments information using the method getApprointmentDetails.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

java program

1. Implement a class named Appointment that contains:
• A private String data field named patientName.
• A private static int data field named newID. This value will be automatically
incremented with the creation of each Appointement object. The initial value of newlID
is 1.
• A private constant (final) int data field named APPOINTEMENT_ID.
• A private int data field named day. The value represents the day of the week from 1 to
5, (1 for Monday, 2 for Tuesday, and so on till Friday).
• A private int data field named hour. Accepted values are 8, 9, 10, ...14
• A constructor that creates a new appointment with specific patient Name given as
argument. Then, the appointment will be immediately assigned a APPOINTEMËNT_ID
according to newID.
• The accessor (getter) methods for patientName and APPOINTEMENT_ID.
The accessor and mutator (setter) methods for the day and hour fields. Note that if the
day value is not in [1,5] then the field is set 0. Also, if the hour is not in [8,14], the field
value is set to 0.
• The method getDayOfTheWeek returns a string representing the day of the week. For
instance, if the day is 1, the method returns "Monday". If the day is 2, it returns
"Tuesday" and so on. If the day is 0, the method returns “Undefined".
• The method getApprointmentDetails that returns a string representation of the
approintment. It contains the appointment ID, the patientName followed by a dash
followed by the day of the week and the hour. For example:
Appointment #1: The patient is HassanMohana - Monday at 10 o'clock.
Write a main program to:
- Create two different appointment. The first appointment object is for patient
"MayaMroueh" on “Thursday" at “13 pm". The second appointment object is read
from the user.
Write the code to check if the two appointments conflict in day and time. If so it
prints a message "The two appointments are set for the same day and day". And
moves one of the appointments to the next day.
Write the code to display the appointments information using the method
getApprointmentDetails.
Transcribed Image Text:1. Implement a class named Appointment that contains: • A private String data field named patientName. • A private static int data field named newID. This value will be automatically incremented with the creation of each Appointement object. The initial value of newlID is 1. • A private constant (final) int data field named APPOINTEMENT_ID. • A private int data field named day. The value represents the day of the week from 1 to 5, (1 for Monday, 2 for Tuesday, and so on till Friday). • A private int data field named hour. Accepted values are 8, 9, 10, ...14 • A constructor that creates a new appointment with specific patient Name given as argument. Then, the appointment will be immediately assigned a APPOINTEMËNT_ID according to newID. • The accessor (getter) methods for patientName and APPOINTEMENT_ID. The accessor and mutator (setter) methods for the day and hour fields. Note that if the day value is not in [1,5] then the field is set 0. Also, if the hour is not in [8,14], the field value is set to 0. • The method getDayOfTheWeek returns a string representing the day of the week. For instance, if the day is 1, the method returns "Monday". If the day is 2, it returns "Tuesday" and so on. If the day is 0, the method returns “Undefined". • The method getApprointmentDetails that returns a string representation of the approintment. It contains the appointment ID, the patientName followed by a dash followed by the day of the week and the hour. For example: Appointment #1: The patient is HassanMohana - Monday at 10 o'clock. Write a main program to: - Create two different appointment. The first appointment object is for patient "MayaMroueh" on “Thursday" at “13 pm". The second appointment object is read from the user. Write the code to check if the two appointments conflict in day and time. If so it prints a message "The two appointments are set for the same day and day". And moves one of the appointments to the next day. Write the code to display the appointments information using the method getApprointmentDetails.
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
void method
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education