Question: Write a class called PatientsHashMap with the main and perform the following operations: o Create a Patient class that has following attributes: Patient id: String

Write a class called PatientsHashMap with the main and perform the following
operations:
o Create a Patient class that has following attributes:
Patient id: String
Patient Name: String
5
Last Visit Date: String
Last visit diagnosis: String
Current Temperature: int
Current weight: int
o Create 10 different patient objects
o Create HashMap called patients that keeps the patient id
as the key of HashMap and patient object as the value.
o Repeat the following 5 times:
Prompt user to enter patient id and then enter a patient id of one of
the above 10 patients
Lookup patients HashMap to find the patient object associated
with the patient id and print patient details on screen
o Print the entire HashMap
o Display the size of the HashMap
o Remove one student from the HashMap
o Use for-each loop to display only keySet of the HashMap
o Use for-each loop to display only values of the HashMap
o Remove all items from the HashMap.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!