C#: Part of a web application must check a value and report back a status if it
ID: 3870948 • Letter: C
Question
C#: Part of a web application must check a value and report back a status if it is in range or if it is too high (think nuclear reactor temperature). The decision is based on this table Range Status Less than or equal to 25 OK Greater than 25 and less than or equal to 40 Warning Greater than 40 and less than or equal to 60 High Greater than 60 Critical Write the code for the body of a method with the following header: /* Determine the status for the value passed as a parameter and return the status as a string. */ public static string getValueStatus(int value)
Explanation / Answer
public static string getValueStatus(int value){
String status=null;
if(value<=25){
status="OK";
}
else if(value>25&&value<=40){
status="Warning";
}
else if(value>40&&value<=60){
status="High";
}
else if(value>60){
status="Critical";
}
return status;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.