Problem 3 (20 pts): Write a script file that will help a doctor monitor the Hear
ID: 3796685 • Letter: P
Question
Problem 3 (20 pts): Write a script file that will help a doctor monitor the Heart Rate and Blood Sugar Level in a diabetic patient. The doctor will input the patient's Heart Rate (HR) and Blood Sugar Level (BSL). The program will determine the condition of the patient and then output the following statement The Patient is categorized as: followed by the correct condition. The following table is used to determine the patient's condition Heart Rate Blood Sugar Level Condition Above 130 Below 80 At Risk 110-130 80-100 Borderline Below 110 Above 100 Normal other Requirements for the Program The values for Heart Rate and Blood Sugar Level should be read into the script file using an input statement. If the HR or BSL is less than zero, the program identifies this as an invalid reading. If the readings put the condition in two different categories the worse condition should be selected. For example, a patient with a HR/BSL of l40/110, respectively, would be categorized as "At Risk" for the Heart Rate and "Normal" for the Blood Sugar Level. Thus, the patient should be considered "At Risk", and the program should output the following statement: The Patient is categorized as: At Risk. Paste the output from 4 runs (1 for each condition and when a negative value is inputted for HR or BSL) of your program here: Paste your script file here:Explanation / Answer
hr = input("Enter heart rate: ");
bsl = input("Enter Blood sugar level: ");
if hr<0 || bsl<0
disp("INVALID READING");
else
printf("PATIENT IS CATEGORIZED AS: ");
if hr>=130 || bsl < 80
printf("AT RISK ");
elseif hr>=110 || bsl <100
printf("AT BORDERLINE ");
else
printf("NORMAL ");
end
end
Example 1:
Enter heart rate: 130 Enter Blood sugar level: 110 PATIENT IS CATEGORIZED AS: AT RISK
Example 2:
Enter heart rate: -2 Enter Blood sugar level: 110 INVALID READING
Example 3:
Enter heart rate: 120 Enter Blood sugar level: 120 PATIENT IS CATEGORIZED AS: AT BORDERLINE
Example 4:
Enter heart rate: 20 Enter Blood sugar level: 493 PATIENT IS CATEGORIZED AS: NORMAL
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.