1. Implement a class named Appointment that contains: A private String data field named patientName. • A private int data field named newID. This value will be automatically incremented with the creation of each Appointement object. The initial value of newID 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 returnms 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. Assignment Guidelines: - This assignment is posted on Monday November 1“ and is due on Sunday November 7". This assignment covers chapters 8. Assignments (the java files or better a complete java project compressed) should be posted to Google Classroom. Do not post documents/text files with the .docx or .txt extension. Make sure that you use meaningful names, documentation (comments), and indentation. The code (program) should contain in the documentation (comments) your name.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 2CP
icon
Related questions
Question
What is the solution for this question ( using java language)
1. Implement a class named Appointment that contains:
• A private String data field named patientName.
• A private int data field named newID. This value will be automatically incremented
with the creation of each Appointement object. The initial value of newID 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 "Undefineď".
• 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.
Assignment Guidelines:
This assignment is posted on Monday November 1“ and is due on Sunday November 7th.
This assignment covers chapters 8.
Assignments (the .java files or better a complete java project compressed) should be posted
to Google Classroom. Do not post documents/text files with the .docx or .txt extension.
Make sure that you use meaningful names, documentation (comments), and indentation.
The code (program) should contain in the documentation (comments) your name.
Transcribed Image Text:1. Implement a class named Appointment that contains: • A private String data field named patientName. • A private int data field named newID. This value will be automatically incremented with the creation of each Appointement object. The initial value of newID 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 "Undefineď". • 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. Assignment Guidelines: This assignment is posted on Monday November 1“ and is due on Sunday November 7th. This assignment covers chapters 8. Assignments (the .java files or better a complete java project compressed) should be posted to Google Classroom. Do not post documents/text files with the .docx or .txt extension. Make sure that you use meaningful names, documentation (comments), and indentation. The code (program) should contain in the documentation (comments) your name.
Expert Solution
trending now

Trending now

This is a popular 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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage