i, this is a java programming question with direction of what to do. I'm just gonna attach the question sheet. Implement the following class diagram (diagram in attached photo) setFirstName() method should set the firstName attribute of the class. setLastName() method should set the lastName attribute of the class. setSpecialization() method should set the specialization attribute of the Doctor class. setHealthnumber() method should set the healthNumber attribute of the Patient class. setIllness() method should set the illness attribute of the Patient class. If you are not comfortable with set methods, you are free to create your own constructors to set the  attribute values.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 3PE
icon
Related questions
Question

Hi, this is a java programming question with direction of what to do. I'm just gonna attach the question sheet.

Implement the following class diagram

(diagram in attached photo)
setFirstName() method should set the firstName attribute of the class.
setLastName() method should set the lastName attribute of the class.
setSpecialization() method should set the specialization attribute of the Doctor class.
setHealthnumber() method should set the healthNumber attribute of the Patient class.
setIllness() method should set the illness attribute of the Patient class.
If you are not comfortable with set methods, you are free to create your own constructors to set the 
attribute values.
Create a HospitalApplication class which contains the main method. Inside the main method the 
following should be done in the order mentioned. (Any other ordering would not guarantee full marks).
Prompt for the following inputs for 5 Doctors. (Use for loops)
• First name
• Last name
• Specialization
Valid specializations are:
• General Physician
• Neurologist
• Nephrologist
• Cardiologist
The specializations are case insensitive (General physician, General Physician and GENERAL PHYSICIAN 
should all be valid.)
If the user enters an invalid specialization
• Print “You entered an invalid specialization”
• Keep prompting the user to enter a valid specialization.
The getName() method should:
• Concatenate the first name and last name with a space between them
• The first letter of the first and last names should be in capitals
• Should return the formatted name
The getSpecialization() method should:
• Capitalize the first letter of specialization and return the specialization
For all the doctors, print the summary (using loops) in the following format:
Name followed by a tab (\t) and then the specialization. For example, if the first doctor entered was:
firstName: John
lastName: Doe
specialization: Cardiologist
The summary should print
Dr. John Doe Cardiologist
And so on for all the 5 doctors
Use an infinite loop to get the following patient information:
First name
Last name
PHN (Personal Health Number)
Illness
PHN should:
• Contain 10 digits to be valid
• Begin with 9 to be valid
If the user enters an invalid PHN:
• Print “You entered an invalid PHN”
• Keep prompting the user to enter a valid PHN.
The illnesses are case insensitive.
Use the following table to identify which doctor can cure the given illness for the patient.
(image in 2nd attchment)
When the user enters valid values: 
• Create a patient object with the passed information
• print the summary as follows (using the patient object):
firstName: Stan
lastName: Smith
PHN: 9999999999
Illness: Heart issue
Stan Smith with PHN 9999999999 has Heart issue
You can be treated by Dr. John Doe
• If there are multiple doctors available for a particular illness, then print all their names 
separated by commas (You can be treated by Dr. John Doe, Dr. John David). 
• If there are no doctors available for a particular illness, then print “Sorry, no doctors available”

If the user enters an invalid PHN:
• Print "You entered an invalid PHN"
Keep prompting the user to enter a valid PHN.
The illnesses are case insensitive.
Use the following table to identify which doctor can cure the given illness for the patient.
Cured by Specialist
General Physician
General Physician
Illness
Cold
Flu
●
Nerve issue
Muscular issue
Heart issue
Kidney issue
When the user enters valid values:
• Create a patient object with the passed information
print the summary as follows (using the patient object):
firstName: Stan
lastName: Smith
PHN: 9999999999
Illness: Heart issue
Neurologist
Neurologist
Cardiologist
Nephrologist
Stan Smith with PHN 9999999999 has Heart issue
You can be treated by Dr. John Doe
If there are multiple doctors available for a particular illness, then print all their names
separated by commas (You can be treated by Dr. John Doe, Dr. John David).
If there are no doctors available for a particular illness, then print "Sorry, no doctors available"
Transcribed Image Text:If the user enters an invalid PHN: • Print "You entered an invalid PHN" Keep prompting the user to enter a valid PHN. The illnesses are case insensitive. Use the following table to identify which doctor can cure the given illness for the patient. Cured by Specialist General Physician General Physician Illness Cold Flu ● Nerve issue Muscular issue Heart issue Kidney issue When the user enters valid values: • Create a patient object with the passed information print the summary as follows (using the patient object): firstName: Stan lastName: Smith PHN: 9999999999 Illness: Heart issue Neurologist Neurologist Cardiologist Nephrologist Stan Smith with PHN 9999999999 has Heart issue You can be treated by Dr. John Doe If there are multiple doctors available for a particular illness, then print all their names separated by commas (You can be treated by Dr. John Doe, Dr. John David). If there are no doctors available for a particular illness, then print "Sorry, no doctors available"
Implement the following class diagram
Doctor
- specialization:String
Person
firstName:String
- lastName:String
+ setFirstName(firstName:String):void
+ setLast(lastName:String):void
+ getName():String
+ setSpecialization (specialization:string):void
+ getSpecialization (): String
healthNumber:long
- illness:String
Patient
+ setillness(illness:String):void
+ getillness(): String
+ setHealthNumber(health Number:long):void
+ getHealthNumber():long
setFirstName() method should set the firstName attribute of the class.
setLastName() method should set the lastName attribute of the class.
setSpecialization () method should set the specialization attribute of the Doctor class.
setHealthnumber() method should set the healthNumber attribute of the Patient class.
setillness() method should set the illness attribute of the Patient class.
If you are not comfortable with set methods, you are free to create your own constructors to set the
attribute values.
Transcribed Image Text:Implement the following class diagram Doctor - specialization:String Person firstName:String - lastName:String + setFirstName(firstName:String):void + setLast(lastName:String):void + getName():String + setSpecialization (specialization:string):void + getSpecialization (): String healthNumber:long - illness:String Patient + setillness(illness:String):void + getillness(): String + setHealthNumber(health Number:long):void + getHealthNumber():long setFirstName() method should set the firstName attribute of the class. setLastName() method should set the lastName attribute of the class. setSpecialization () method should set the specialization attribute of the Doctor class. setHealthnumber() method should set the healthNumber attribute of the Patient class. setillness() method should set the illness attribute of the Patient class. If you are not comfortable with set methods, you are free to create your own constructors to set the attribute values.
Expert Solution
steps

Step by step

Solved in 4 steps with 6 images

Blurred answer
Knowledge Booster
Top down approach design
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
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,