Hi I'm writing this program for my Computer Science class that takes in the user's grades(Two quizes, a Midterm, and a Final), averages them, and outputs the numerical and letter grade. I finished the program but it gives me this error on line 42 and 44 which says "error: invalid conversion from 'double (*)(int,int)' to 'int'" Can someone help me please?
Here is some other information about the assignment:
Write a grading program for a class with the following grading policies:
a. There are two quizzes, each graded on the basis of 10 points.
b. There is one midterm exam and one final exam, each graded on the basis of 100 points.
c. The final exam counts for 50% of the grade, the midterm counts for 25%, and the two quizzes together count for a
total of 25%. (Do not forget to normalize the quiz scores. They should be converted to a percentage before they are
averaged in.)
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
|
#include<iostream>
#include<cstdlib>
#include<string>
using namespace std;
class Student{
public:
void averageGrade();
int ID;
string firstName;
string lastName;
double quiz1;
double quiz2;
double midterm;
double final;
};
double calcQuiz(int q1, int q2);
double calcMidFin(int mid, int fin);
void letterGrade(int finGrade);
int main(){
Student info, grade;
cout << "Please Enter Your Student ID:";
cin >> info.ID;
cout << "Please Enter Your First Name:";
cin >> info.firstName;
cout << "Please Enter Your Last Name:";
cin >> info.lastName;
do{
cout << "Please Enter Your Grade for Quiz 1 and 2 (Out of 10 Points for Each Quiz):" << endl;
cin >> grade.quiz1 >> grade.quiz2;
}while(grade.quiz1 > 10 && grade.quiz2 > 10); //Asks the user to input grade again if their input is over 10
cout << "Please Enter Your Grade for Midterm (Out of 100):" << endl;
cin >> grade.midterm;
cout << "Please Enter Your Grade for Final Exam (Out of 100):" << endl;
cin >> grade.final;
calcQuiz(grade.quiz1,grade.quiz2);
int finalQuiz = calcQuiz;
calcMidFin(grade.midterm,grade.final);
int totalMidFin = calcMidFin;
int gradeAverage = finalQuiz + totalMidFin;
int finalGrade = gradeAverage*100
letterGrade(finalGrade);
cout << "Your Student Information is:" << endl
cout << info.ID << endl;
cout << info.firstName << " " << info.lastName << endl;
cout << "Quiz 1: " << grade.quiz1 << endl;
cout << "Quiz 2: " << grade.quiz2 << endl;
cout << "Midterm: " << grade.midterm << endl;
cout << "Final: " << grade.final << endl;
cout << "Your Numerical Grade Is: " << finalGrade << endl;
cout << "Your Letter Grade Is: " << letterGrade << endl;
return 0;
}
double calcQuiz(int q1, int q2){
int newQuiz1 = q1*10; //Convert the quizes so they are out of 100 points
int newQuiz2 = q2*10;
int sum = newQuiz1 + newQuiz2; //Takes the average of both quizes
int quizAverage = sum/2;
double finalQuiz = quizAverage*0.25;
return finalQuiz;
}
double calcMidFin(int mid, int fin){
double midGrade = mid*0.25;
double finGrade = fin*0.5;
int midfin = midGrade + finGrade;
return midfin;
}
void letterGrade(int finGrade){ //Determines Letter Grade
if(finGrade>=90)
cout << "A";
else if(finGrade>=80 && finGrade<90)
cout << "B";
else if(finGrade>=70 && finGrade<80)
cout << "C";
else if(finGrade>=60 && finGrade<70)
cout << "D";
else if(finGrade<60)
cout << "F";
}
|