My instructor asked: Your job is to create a program that takes, from keyboard input:
1. The number of students in the class
2. number of points for an assignment
3. grades for the class.
You will average the grades and figure out how much of a curve should be applied for the average class score to be at least 70%. A curve should never be negative. Therefore if the calculation of the curve is negative, the curve will be 0.
#include<iostream>
usingnamespace std;
int main()
{
int Points; //Number of Points student scored on assignment
int Total; //Individual student percentage grade
int avgTotal; //combined total of student percentage
int pointsPossible; //Amount of points possible on assignment
int avgClass; //Average of all classmates grades combined
int Curve; //Computes the amount necessary for curve
int curvedGrade; //Applied to class averages less than 70%
int Students = 0; //Number of students within class
int studentNumber; //Identifies each student by number
int n = 0;
cout << "Enter the number of students in class : "; //How many students are in the class
cin >> Students;
studentNumber = n + 1; //current student on list
cout << "How many points possible in assignment : ";
cin >> pointsPossible;
while (studentNumber <= Students) {
cout << "Enter points for student number " << studentNumber << " : "; //how many points did this student score
cin >> Points;
Total = (Points / pointsPossible); //calculates percentage for student grade
avgTotal = (avgTotal + Total); //Keeps running total of all student grades
avgClass = (avgTotal / Students); //calculates average grade of entire class
cout << "The average grade for this class is " << avgTotal;
if (avgClass >= 70) {
cout << avgClass; //if class average is above 70% no curve applies
}
else {
Curve = 70 - avgClass;
curvedGrade = avgClass + Curve; //if class average is below 70% curve applies
cout << curvedGrade;
}
}
return 0;
}
Problems i'm having:
1. Can't get program to loop
2. Doesn't compute from Total calculation on down.