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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
|
string getScores(int, int);
int menuOfSubjects();
bool validateInput(int, int, int, string);
void
moreFunk()
{
int pointsEarned = 0; // total points
int totalPoints = 0;
bool menuFlag = true;
while (menuFlag)
{
int choice = menuOfSubjects();
switch (choice)
{
case PHYSICS_CHOICE:
cout << "Please enter points earned" << endl;
cin >> pointsEarned;
cout << "Please enter total points" << endl;
cin >> totalPoints;
string getScores(int pointsEarned, int totalPoints);
cout <<"Your grade was: " << getScores << endl;
break;
case BIOLOGY_CHOICE:
cout << "Please enter points earned" << endl;
cin >> pointsEarned;
cout << "Please enter total points" << endl;
cin >> totalPoints;
string getScores(int pointsEarned, int totalPoints);
cout <<"Your grade was: " << getScores << endl;
break;
case CALCULUS_CHOICE:
cout << "Please enter points earned" << endl;
cin >> pointsEarned;
cout << "Please enter total points" << endl;
cin >> totalPoints;
string getScores(int pointsEarned, int totalPoints);
cout <<"Your grade was: " << getScores << endl;
break;
case GEOGRAPHY_CHOICE:
cout << "Please enter points earned" << endl;
cin >> pointsEarned;
cout << "Please enter total points" << endl;
cin >> totalPoints;
string getScores(int pointsEarned, int totalPoints);
cout <<"Your grade was: " << getScores << endl;
break;
case SOCIOLOGY_CHOICE:
cout << "Please enter points earned" << endl;
cin >> pointsEarned;
cout << "Please enter total points" << endl;
cin >> totalPoints;
string getScores(int pointsEarned, int totalPoints);
cout <<"Your grade was: " << getScores << endl;
break;
case COMPUTERSCIENCE_CHOICE:
cout << "Please enter points earned" << endl;
cin >> pointsEarned;
cout << "Please enter total points" << endl;
cin >> totalPoints;
string getScores(int pointsEarned, int totalPoints);
cout <<"Your grade was: " << getScores << endl;
break;
case POLYMERS_CHOICE:
cout << "Please enter points earned" << endl;
cin >> pointsEarned;
cout << "Please enter total points" << endl;
cin >> totalPoints;
string getScores(int pointsEarned, int totalPoints);
cout <<"Your grade was: " << getScores << endl;
break;
case QUIT_CHOICE:
cout << "Program ending.\n";
}
}
cout << "end of more functions" << endl;
cin.get();
}
//*******************************************
// TASK 5 CODE - PLACE CODE HERE FOR TASK
//*******************************************
int menuOfSubjects()
{
int choice;
bool loopFlag = true;
string msg("Please choose a subject from the menu ");
cout << "Please choose a subject from the menu \n\n";
cout << "1. Physics\n";
cout << "2. Biology\n";
cout << "3. Calculus\n";
cout << "4. Geography\n";
cout << "5. Sociology\n";
cout << "6. Computer Science I\n";
cout << "7. Properties of Solid Polymers\n";
cout << "8. Quit\n";
while (loopFlag){
cout << "Enter your choice (1-8): ";
cin >> choice;
loopFlag = validateInput(choice, 1, 8, msg);
}
return choice;
}
string getScores(int pointsEarned, int totalPoints){
string grade = " ";
int gradePercentage = ((pointsEarned) / static_cast<float>(totalPoints) * 100);
if ((gradePercentage) > 92.99)
{
grade = "A";
}
else if ((gradePercentage) > 89.99)
{
grade = "A-";
}
else if ((gradePercentage) > 86.99)
{
grade = "B+";
}
else if ((gradePercentage) > 82.99)
{
grade = "B";
}
else if ((gradePercentage) > 79.99)
{
grade = "B-";
}
else if ((gradePercentage) > 76.99)
{
grade = "C+";
}
else if ((gradePercentage) > 72.99)
{
grade = "C";
}
else if ((gradePercentage) > 69.99)
{
grade = "C-";
}
else if ((gradePercentage) > 66.99)
{
grade = "D+";
}
else if ((gradePercentage) > 62.99)
{
grade = "D";
}
else if ((gradePercentage) > 59.99)
{
grade = "D-";
}
else if ((gradePercentage) < 59.99)
{
grade = "F";
}
return grade;
}
|