please asisst for I am forever lost...

I am suppose to create a program to compute a students weighted course grade but I am not getting the results I want and the the program to display how I want it to. Below is the intstructions for the project along with how it is suppose to output when ran but when I debug my code and run it it does not compute the overall average how I want it. when I use the numbers given in the example to test the program it outputs an overall grade of 94.4 instead of the average 80.93. I also for some reason can't get the percent sign to show. I am missing a step but not sure where..I knwo that 101/150 is 67 which is the number needed to get 80.93 . which tells me that I have to get the scorees divded by the maximum points on test but no matter how many different timesI write it it does not out put what I want or perform that action.



Write a program to compute a student's weighted course score. There are three tests in the class. The user should enter the maximum points for each test (they do not have to be the same) (integer), the student's score on each test (integer), and the weight of each test (as a percent of 1.0 (0.4 = 40%)) (floating-point value). Your code should output the student's weighted course grade.

Example 1:

Weight of first test: 30
Maximum on first test: 100
Score on first test: 93

Weight of second test: 30
Maximum on second test: 100
Score on second test: 87

Weight of third test: 40
Maximum on third test: 150
Score on third test: 101

Your overall grade is 80.93%



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
#include <iostream>
#include <string>

using namespace std;

int main()
{




int score1 = 0;
int score2 = 0;
int score3 = 0;
int test1 = 0;
int test2 = 0;
int test3 = 0;
double weight1 = 0;
double weight2 = 0;
double weight3 = 0;
double weight = 0;



cout << "Weight of first test:";
cin >> weight1; 

cout << "Maximum on first test:";
cin >> test1; 

cout << "score on first test:";
cin >> score1; 





cout << "Weight of second test:";
cin >> weight2; 

cout << "Maximum on second test:";
cout >> test2; 

cout << "Score on first test:";
cin >> score2; 






cout << "Weight of third test:";
cin >> weight3; 

cout << "Maximum on third test:";
cin >> test3; 

cout << "score3 on first test:";
cin >> score3; 



weight = score1* weight1 + score2 * weight2 + score3 * weight3;

cout << " Your overall grade is " << weight << "\n";

system ("pause");
return 0;



}

Last edited on
Firstly, always use code tags - edit your post, select the code, press the <> button on the right under format.


Think about what happens when the maximum score is achieved for each test?

To display the % symbol:

cout << " Your overall grade is " << weight << "%" << "\n";

or in this case:

cout << " Your overall grade is " << weight << "%\n";

Also, consider using arrays to reduce your code.

I can't see why you need to include the <string> header.

HTH
thank you for your input and advice

arrays? I have yet to learn about arrays in class yet. What are they
Have a read of the tutorial on this site :) Top left of this page.

HTH
oh I see
so array compact my intergers
Topic archived. No new replies allowed.