4. You have just developed a new glucose sensor for people to monitor their bloo
ID: 3881326 • Letter: 4
Question
4. You have just developed a new glucose sensor for people to monitor their blood sugar and test for diabetes. The definitions of "normal", "impaired glucose tolerance" (also called prediabetes) and "diabetic" depend not only on the blood sugar reading, but how soon it was taken after a meal, as given in the table below. (Note, do not use this table to make a medical diagnosis) Fasting After Eating 2-3 hours after Eating 80-100 170-200 120-140 101-125 201-230 140-200 Glucose level (mg/dL) Normal Impaired Glucose Tolerance, or "prediabetes" Diabetic 126+ 231+ 201+ Write a program that will take as input the glucose level and time after eating, and tell the user whether their blood sugar levels indicate Normal, Prediabetic, or Diabetic valuesExplanation / Answer
Matlab code:
glc = input('Enter the glucose level: ');
disp('The time after eating: ');
disp('1. Fasting');
disp('2. After eating');
disp('3. 2-3 hours after eating');
opt = input('Enter 1,2 or 3 for the above options: ');
if(opt == 1)
if glc >= 80 && glc <= 100
disp('Normal');
elseif glc >= 101 && glc <= 125
disp('Impaired glucose tolerance');
elseif glc >= 126
disp('Diabetic');
else
disp('Wrong input !!!!');
end
elseif (opt == 2)
if glc >= 170 && glc <= 200
disp('Normal');
elseif glc >= 201 && glc <= 230
disp('Impaired glucose tolerance');
elseif glc >= 231
disp('Diabetic');
else
disp('Wrong input !!!!');
end
elseif (opt == 3)
if glc >= 120 && glc <= 140
disp('Normal');
elseif glc >= 141 && glc <= 200
disp('Impaired glucose tolerance');
elseif glc >= 201
disp('Diabetic');
else
disp('Wrong input !!!!');
end
else
disp('Wrong input !!!');
end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.