Sep 14, 2012 at 5:11pm UTC
using namespace std;
int main ()
cout << "Enter grade, in points, for Midterm out 250 points: ";
cin >> midterm;
cout << "Enter grade, in points, for final out of 250 points: ";
cin >> final;
cout << "Enter grade, in points, for Research Paper out of 150 points: ";
cin >> researchPaper;
cout << "Enter grade, in points, for Group Project out of 150 points: ";
cin >> groupProject;
cout << "Enter grade, in points, for participation out of 50 points: ";
cin >> participation;
float midterm2 = (midterm/250)*.25;
float final2 = (final/250)*.25;
float groupProject2 = (groupProject/150)*.20;
float researchPaper2 = (researchPaper/250)*.20;
float participation2 = (participation/50)*.10;
float classgrade = (midterm2 + final2 + groupProject2 + researchPaper2 + participation) * 100;
cout << "Your class grade: " << classgrade << "%" << endl;
Sep 14, 2012 at 5:13pm UTC
When I put input numbers to come out as 76%; I get 5000%. Obviously something is wrong haha.
Sep 14, 2012 at 5:21pm UTC
The way I read it, you should be getting 0%. So I'm missing something on first reading.
The first thing you need to do is get rid of the integer division. change to
. Do that for all of your grade components.
See where that gets you.
Sep 14, 2012 at 5:23pm UTC
Oh. you added participation into your final instead of participation2. You probably entered '50' for participation, and (50 * 100) = 5000.
Sep 14, 2012 at 5:29pm UTC
That's getting closer. I replaced them with the Floats, and I also replaced participation with participation2(good eye). For some reason, its still not completely accurate, mathematically. I'm getting 46% when I input 50% assignments, and at the 76% mark, I'm getting 71%.
Sep 14, 2012 at 5:32pm UTC
Found it. I had researchPaper2 = researchPaper/250 rather than 150.