Please send questions to
st10@humboldt.edu .
/*--------------------------------------------------
created by smtuttle at Mon May 3 13:33:38 PDT 2010
--------------------------------------------------*/
#include <iostream>
#include <cmath>
using namespace std;
/*--------------------------------------------------
Contract: grade_msg : char -> string
Purpose:
expects a char corresponding to a letter grade,
and produces the appropriate string for that grade,
according to the following:
'A' or 'B' ---> "High pass"
'C' or 'D' ---> "Pass"
'F' or 'I' ---> "Try again"
anything else ---> "Huh?"
Examples:
grade_msg('A') == "High pass"
grade_msg('D') == "Pass"
grade_msg('F') == "Try again"
grade_msg('Q') == "Huh?"
--------------------------------------------------*/
string grade_msg(char grade)
{
string desired_msg;
// get the desired message for this letter grade
switch(grade)
{
case 'A':
case 'B':
desired_msg = "High pass";
break;
case 'C':
case 'D':
desired_msg = "Pass";
break;
case 'F':
case 'I':
desired_msg = "Try again";
break;
default:
desired_msg = "Huh?";
}
return desired_msg;
}