Really confused
For my C++ class
Here is what i need to do
http://puu.sh/kJFbm/de922c4367.png
i have this so far and not sure if im going in the right direction
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
#include <iostream>
#include <iomanip>
using namespace std;
const double ESN = 90.00;
const double RRC = 200.00;
const double ACR = 250.00;
const double FC = 400.00;
const double M = 30.00;
const double D = 35.00;
int main()
{
int sid, uni, rc;
char r_type, grad;
double cfu, total;
cout << "Student ID number: ";
cin >> sid;
cout << endl;
cout << "Type of room(R/A): ";
cin >> r_type;
cout << endl;
cout << "# of units: ";
cin >> uni;
cout << endl;
cout << "Are you graduating?(Y/N): ";
cin >> grad;
cout << endl;
cfu = uni * ESN;
switch (r_type)
{
case 'r':
case 'R':
r_type = RRC;
break;
case 'a':
case 'A':
r_type = ACR;
break;
default:
cout << "Incorrect room type. Room charge not calculated." << endl;
}
switch (grad)
{
case 'y':
case 'Y':
total = r_type + cfu + M + D;
break;
case 'n':
case 'N':
total = r_type + cfu + M;
break;
}
if (uni > 21)
{
cout << "this is not allowed." << endl;
system("pause");
}
if (uni < 12)
cout << "not full time student" << endl;
cout << "Student ID" << setw(10) << sid << endl;
cout << "Units" << setw(10) << uni << endl;
cout << "Charge for units" << setw(10) << cfu << endl;
cout << "Room charge" << setw(10) << rc << endl;
cout << "Food charge" << setw(10) << FC << endl;
cout << "Matriculation Fee" << setw(10) << M << endl;
cout << "Total semester charges" << setw(10) << total << endl;
return 0;
}
|
Last edited on
Topic archived. No new replies allowed.