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 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. a • 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. 2. Write a program that read a String from the user then removes the spaces and replaces every letter m (if exists) with a space. For example, if the string is "Mom someone tried to mug Brad“, the program displays "o so eonetriedto ugBrad"

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
100%
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,
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 appointment will be
immediately assigned
a
• 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.
2. Write a program that read a String from the user then removes the spaces and replaces
every letter m (if exists) with a space. For example, if the string is “Mom someone
tried to mug Brad“, the program displays "o so eonetriedto ugBraď"
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, 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 appointment will be immediately assigned a • 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. 2. Write a program that read a String from the user then removes the spaces and replaces every letter m (if exists) with a space. For example, if the string is “Mom someone tried to mug Brad“, the program displays "o so eonetriedto ugBraď"
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 7 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