Write a c program that reads in the daily hazard index for each of the three pol
ID: 3584850 • Letter: W
Question
Write a c program that reads in the daily hazard index for each of the three pollutants and that
identifies the smog level of the air as low or medium or first-stage alert or second-stage alert.
If all indices are less than or equal to
100, the smog level listed as “low” in forecasts. If any index rises above 100, the smog level
is listed as “medium”. If any index rises above 200, the smog level is listed as a “first-stage
alert”. If any index exceeds 275, the smog level is listed as a “second-stage alert”.
Explanation / Answer
string smogLevel;
if(index1<=100 && index2<=100 && index3<=100)
smogLevel="low";
if(index1>100 || index2>100 || index3>100)
smogLevel="low";
if(index1>200 || index2>200 || index3>200)
smogLevel="first-stage alert";
if(index1>275 || index2>275 || index3>275)
smogLevel="second-stage alert";
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.