Homework 5 Problem 5

Homework 5 Problem 5

You cannot submit for this problem because the homework's deadline is due.

Background

Implement part of a simple hospital management system.

Description

The system has a user interface to accept user command, after the prompt “>”, and respond accordingly. Repeats until the user enters the command ’quit’. Prints an error message if the user enters an illegal command. Let’s assume the number of patients that can be accommodated by this hospital is 100. The socialID is 6 digits long. The following are the user commands that can be accepted:

checkIn socialID

Register a new patient to the system given the unique social id num-ber. You should check if the social ID already exists in the system. If it is, let the user know (“Patient already exists in the system.”). The checkIn function will further ask for patient’s age and current temper-ature, and inform user when the ”Registration succeed!”. You should check if the entered temperature is above the threshold (37.5 Celsius degree), and let user know if it is above the threshold “Abnormal tem-perature detected!”).

checkOut socialID

Delete a patient from the system given the unique social id number. You should check if the patient under this social ID is already not in the system. If yes, let the user know (“Patient not in the system.”).

edit socialID

Allow users to add current temperature into the corresponding tem-perature history of the past week of a given patient. Temperature is recorded one time per day.

info socialID

Display the information about this patient in the system, including socialID, age, and temperature history (reverse chronologically from recent to the old record). Let the user know if this social ID is not in the system.

order temp

Display the list of patient’s ID currently registered in the sytem and their most recent temperature. The displayed list is ordered by their most recent temperature in ascending order. If two temperatures are the same, output the one with a smaller ID first.

quit

Exit the system!

If the user type any other undefined commands, just prompt for Unknown command.

You should design the underlying data structure to sup-port the above commands. A sample run of the program is shown below, please follow the output format in the sample:

Sample 1

Input

info 123456
blah
checkIn 123456
30 37
checkIn 123457
28 38
edit 123457
36.5
info 123457
order temp
checkOut 123456
quit

Output

Welcome to the hospital management system, please type in your command.
> There is no patients under this ID yet.
> Unknown command.
> Please input this patient's age and temperature
Registration succeed!
> Please input this patient's age and temperature
Registration succeed!
Abnormal temperature detected!
> Please input the updated temperature
> 123457 Age: 28 Temp: 36.5 38.0
> 123457 28 36.5
123456 30 37.0
> 
> Exit the system!

Limitation

1s, 1024KiB for each test case.

Homework 5

Not Claimed
Status
Finished
Problems
5
Open Since
2020-07-12 00:00
DDL
2020-07-20 23:59
Extension
48.0 hour(s)