Related questions
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"
Step by stepSolved in 4 steps with 6 images
- i have got my one solution . thank you sir. as rules you've asked me to submit my another question once more. so, this is my another question .i hope soon i will get my ans for this question also. thank you again sir.arrow_forwardPlease look at the images for the programming question. I am not sure sure where I should start on this. All coding is done in Java, using IntelliJ Idea.arrow_forwardPlease the code in Java eclipse. Please add comments for each instructions given in the image. I'll appreciate your help. And send the screenshoot of the output.arrow_forward
- Hello, I don’t understand this Java Question may someone help me out, may you also type out the code please and take a screenshot ? The second image that's grey is the example to go off ofarrow_forwardHello, I don’t understand this Java Question may someone help me out, may you also type out the code please and take a screenshot ?arrow_forwardDesign a class hierarchy for a simple banking system. Include classes for a Bank, Account, and Customer. Implement methods for depositing and withdrawing money, transferring funds between accounts, and checking the account balance.arrow_forward
- After drawing the hierarchy, implement the classes by writing C# code foreach class. Then create objects of each class and call ALL methods onthese objects.arrow_forwardCan comments be added to describe the functionality of each class/method and any other important detail worth knowing about? Also, does the program follow standard practices of modularity? Thank youarrow_forwardDesign and implement a set of classes that define the employees of a hospital: doctor, nurse, administrator, surgeon, receptionist, janitor, and so on. Include methods in each class that are named according to the services provided by that person and that print an appropriate message. Create a main driver class to instantiate and exercise several of the classes.arrow_forward
- Create a UML class diagram of the application illustrating class hierarchy, collaboration, and the content of each class. There is only one class. There is a main method that calls four methods. I am not sure if I made the UML Class diagram correct. import java.util.Random; // import Random packageimport java.util.Scanner; // import Scanner Package public class SortArray{ // class name public static void main(String[] args) { //main method Scanner scanner = new Scanner(System.in); // creates object of the Scanner classint[] array = initializeArray(scanner); System.out.print("Array of randomly generated values: ");displayArray(array); // Prints unsorted array sortDescending(array); // sort the array in descending orderSystem.out.print("Values in desending order: ");displayArray(array); // prints the sorted array, should be in descending ordersortAscending(array); // sort the array in ascending orderSystem.out.print("Values in asending order: ");displayArray(array); // prints the...arrow_forwardDirections: SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA. Notes: • Assume that the classes listed in the Java Quick Reference have been imported where appropriate. • Unless otherwise noted in the question, assume that parameters in method calls are not null and that methods are called only when their preconditions are satisfied. • In writing solutions for each question, you may use any of the accessible methods that are listed in classes defined in that question. Writing significant amounts of code that can be replaced by a call to one of these methods will not receive full credit. Consider a guessing game in which a player tries to guess a hidden word. The hidden word contains only capital letters and has a length known to the player. A guess contains only capital letters and has the same length as the hidden word. After a guess is made, the player is given a hint that is based on a comparison between the hidden word and the guess. Each position in the...arrow_forwardIn Java!!!!!This is a multi-part question. Consider the following UML diagram on attached image: 1.Write Java classes corresponding to the UML diagram. 2. Write getters and setters for all classes 3. Write non-default constructors for each class that initializes all instance variables to values passed as arguments to the constructor 4. Write toString method for each class 5. Modify Vehicle class to maintain inventory (list of all vehicles created) and print the list. What variable(s) you need to add? What additional method(s) you need? What else needs to be modified in the Vehicle class? Do you need to modify any of the descendant classes and explain your answer (if not: why not; if yes, describe what changes). Vehicle {Abstract} manufacturer:String - color:String Car Truck TwoWheeler {Abstract} -numberOfDoors:int -numberOfAxels:int -passengerSeats:int -fuelType:String -fuelLevel:int -fuelType:String -numberOfSeats:int -fuelLevel:int Truck Motorcycle -numberOfAxels:int -fuelType:String...arrow_forward
- Text book imageDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationText book imageStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONText book imageDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- Text book imageC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONText book imageDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningText book imageProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education