/***********************************************************/ /* */ /* This program will read a character value from the user */ /* representing their status for KU parking. It will then */ /* print their status and display the fee owed. */ /* */ /* Possible values: */ /* Faculty - F - $10 per semester */ /* Staff - S - $10 per semester */ /* Commuter student - C- $30 per semester */ /* Resident student - R - $20 per semester */ /* */ /***********************************************************/ #include #include using namespace std; int main () { char status; float fee; string statStr; cout << "Possible status values at Kutztown: " << endl; cout << "\tF - faculty" << endl; cout << "\tS - staff" << endl; cout << "\tC - commuter student" << endl; cout << "\tR - resident student" << endl; cout << "Enter your status at Kutztown (F, S, C or R): "; cin >> status; // write a switch statement to calcualate fee owed switch (status) { case 'F': case 'f': cout << "Faculty" << endl; fee = 10; break; case 'S': case 's': cout << "Staff" << endl; fee = 10; break; case 'C': case 'c': cout << "Commuter Student" << endl; fee = 30; break; case 'R': case 'r': cout << "Resident Student" << endl; fee = 20; break; default: cout << "Error: status must be F, S, C, or R" << endl << endl; return 0; // end program } // end switch cout << fixed << showpoint << setprecision(2); cout << "Fee is $" << fee << endl; return 0; } // end main