Using nested if structures write a MATLAB script that will t

Using nested if structures, write a MATLAB script that will take the patient\'s temperature (in A degree F) as keyboard input from the user. If the patient\'s temperature is higher than normal (> 98.6), display The patient has a fever! and ask the user to input (at the keyboard) the patient\'s white blood cell count (in leucocytes/microliter). Then, if the white blood cell count is greater than or equal to 10500, display the message Antibiotics should be prescribed!; otherwise, display the message Take two aspirin and call me in the morning.

Solution

MATLAB CODE

clc;clear all; % clearing the workspace and command window
% User input the temperature for this message
Temperature = input(\'Enter the patient\'\'s temperature in degree F: \');
if(Temperature >98.6) % Checking the temperature is above normal temperature or not
fprintf(\'The patient has a fever!\ \'); % if yes print this message
% And ask the user to enter the blood count
BloodCell = input(\'Enter the patient\'\'s white blood cell count in leucocytes/microliter :\');
if(BloodCell >= 10500) % check wether the blood is more than or equal to 10500 or not
fprintf(\'Antibiotics should be prescribed!\ \'); % if yes print theis message
else % if it is not then print this message
fprintf(\'Take two aspirin and call me in the morning.\ \');
end % End of the if condition for blood cound
end % End of the if condition for the temperature check
  

OUTPUT:1

Enter the patient\'s temperature in degree F: 100
The patient has a fever!
Enter the patient\'s white blood cell count in leucocytes/microliter :30020
Antibiotics should be prescribed!

OUTPUT:2

Enter the patient\'s temperature in degree F: 99.3
The patient has a fever!
Enter the patient\'s white blood cell count in leucocytes/microliter :1500
Take two aspirin and call me in the morning.

 Using nested if structures, write a MATLAB script that will take the patient\'s temperature (in A degree F) as keyboard input from the user. If the patient\'s

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site