Trying to convert numerical grades to letter grades

Feb 2, 2017 at 6:34pm
Firstly, thank you to those who may be able to assist me. I am doing an assignment in which I have to convert numerical grades into letter grades. I am trying to go one step further and create a program that can do the later, but also switch a letter grade to a numerical grade range.

I have made an option to enter 1 or 2 to specify which way they want a grade converted within a loop, but I can not seem to get the program to start at the very top to start all over. Once the user enters a decision the program runs and only stays within that specific decision. It will not allow me to start over and choose a different method.

Could anyone help me with this?

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
#include<iostream>
#include"Input_Validation_Extended.h"
using namespace std;

int main()
{
	//solve the program page 1 of the week 2/3 packet
	char LetterGrade = '\0';
	double NumericalGrade = '0';
	int decision = '0';
	/*
	The above statement declares the Numerical Grade
	This assigns the grade which allows for the computing of the grade into a Letter Grade
	*/
	while (decision != '3')
	{
		cout << "Please Specify to run program:\n\n\n" << endl;
		cout << "For a letter grade to numerical range, Press 1" << endl;
		cout << "For a numerical grade to a letter grade, press 2" << endl;
		cout << "\n(***If you would like to cancel, enter a different number***)\n\n" << endl;
		decision = validateInt(decision);
		/*
		The following block allows a user to input a letter grade for a numerical grade range
		*/
		while (LetterGrade != 'e')
		{

			if (decision == 1)
			{
				cout << "\nWhat is your grade? \nPlease enter letter grade!\n\n " << endl;
				cout << "[***If you would like to exit, press 'E'***]\n\n\n" << endl;
				//********cout << "------------------------------------" << endl;
				/*
				cin >> LetterGrade; //deleted for validation input
				*/
				LetterGrade = validateChar(LetterGrade);//replaces the cin << statement & validates data type

				//Adding the grade letter a or A
				if (LetterGrade == 'A' || LetterGrade == 'a')
				{
					cout << "Your letter grade entered was " << LetterGrade << " which means your numerical grade must range from 90.00 to 100...\nYou are doing great!\nKeep studying to maintain that A!\n\n";
				}


				//Adding the grade letter b or B
				else if (LetterGrade == 'B' || LetterGrade == 'b')
				{
					cout << "Your letter grade entered was " << LetterGrade << " which means your numerical grade must range from 80.00 to 89.99...\nYou are doing well!\nKeep studying for that A!\n\n";
				}


				//Adding the grade letter c or C
				else if (LetterGrade == 'c' || LetterGrade == 'C')
				{
					cout << "Your letter grade entered was " << LetterGrade << " which means your numerical grade must range from 70.00 to 79.99...\nYou are doing ok for now!\nInvest more time in studying!\n\n";
				}


				//Adding the grade letter d or D
				else if (LetterGrade == 'd' || LetterGrade == 'D')
				{
					cout << "Your letter grade entered was " << LetterGrade << " which means your numerical grade must range from 60.00 to 69.99...\nYou are doing poorly at the moment!\Studying is essential for a better grade!\n\n";
				}


				//Adding the grade letter f or F
				else if (LetterGrade == 'F' || LetterGrade == 'f')
				{
					cout << "Your letter grade entered was " << LetterGrade << " which means your numerical grade must be below 60.00...\nYou are doing awful!\Studying is essential for a better grade!\nYou need to invest more time and effort...\n\n";
				}






				//If program exits
				else if (LetterGrade == 'e' || LetterGrade == 'E')
				{
					cout << "thank you for using this app! Goodbye!\n";
					break;
				}
				//If entry is not valid
				else
				{
					cout << "\nI'm sorry, I could not determine your grade!\nPlease try again.\n";
				}
			}
			else if (decision == 2)
			{
				cout << "\nTo proceed, I need some more information!\n";
				NumericalGrade = validateDouble(NumericalGrade);//Validates data input to verify it is indeed a double.

				if (NumericalGrade < 60.00)
				{
					cout << "\nYou have a F, and should attend class more often.\nYou may need to consult with your instructor!\n";
				}


				else if (NumericalGrade >= 60 && NumericalGrade <= 64.9999)
				{
					cout << "\nYou have a 'D-' which is barely passing.....\nI suggest that you speak to your instructor!\n";
				}


				else if (NumericalGrade >= 65.00 && NumericalGrade <= 69.999999)
				{
					cout << "\nYou have a 'D+' which is passing....\nYou may need to speak to your instructor!\n";
				}


				else if (NumericalGrade >= 70.00 && NumericalGrade <= 74.999999)
				{
					cout << "\nYou have a 'C-' which is passing...But could you do better?\nI suggest you make more time to study!\n";
				}


				else if (NumericalGrade >= 75.00 && NumericalGrade <= 79.999999)
				{
					cout << "\nYou have a 'C+' which is fair...\nI suggest you make more time to study!\nPush yourself for that 'B' you deserve!!!\n";
				}


				else if (NumericalGrade >= 80.00 && NumericalGrade <= 84.999999)
				{
					cout << "\nYou have a 'B-' Which is great!\nWith more time to study, you could achieve an 'A'!\n";
				}


				else if (NumericalGrade >= 85.00 && NumericalGrade <= 89.999999)
				{
					cout << "\nYou have a 'B+' and I suggest you make more time to study!\n";
				}


				else if (NumericalGrade >= 90.00 && NumericalGrade <= 94.999999)
				{
					cout << "\nYou have a 'A-' Which is fantastic!\nCan you push yourself to achieve an A+?n/Time to study!n/";
				}


				else if (NumericalGrade >= 95.00 && NumericalGrade <= 99.9999)
				{
					cout << "\nYou have a 'A+' Which is close to perfection!\nCan you push yourself to achieve an A+?\nTime to study!\n";
				}

				else if (NumericalGrade == 100)
				{
					cout << "\nAre you a A.I. or what?!\nI may have found my soul mate!\n";
				}
//test
//If program exits
				else//default clause
				{
					cout << "\nSomething went wrong!!!\nHopefully there weren't any sparks...\n";
				}
			}
			//else for decision
			else 
			{
				break;
			}


}

		return 0;//Press Ctrl + F5, yes to run
	}
}
Feb 2, 2017 at 8:28pm
Is that return at line 167 in the correct place? Shouldn't it be outside all of your loops?

Last edited on Feb 2, 2017 at 8:29pm
Topic archived. No new replies allowed.