calculate the grade point average (GPA) of a student in a class that assigns ten
ID: 3888418 • Letter: C
Question
calculate the grade point average (GPA) of a student in a class that assigns ten (10) homeworks, five (5) quizzes, a midterm and a final. The students grades will be stored in an array in the following order:
the program should define the following function
function name: GetHomeworks()
Parameter(s): grds: float array
Returns: void
Assigment Indices Homework 1 0 Homework 2 1 Homework 3 2 Homework 4 3 Homework 5 4 Homework 6 5 Homework 7 6 Homework 8 7 Homework 9 8 Homework 10 9 Quiz 1 10 Quiz 2 11 Quiz 3 12 Quiz 4 13 Quiz 5 14 Midterm 15 Final 16Explanation / Answer
void GetHomeworks()
{
float grds[20];
float sum=0.00,gpa=0.00;
for(int i=0;i<=9;i++)
{ cout<<"Enter grade for Homework "<<i+1<<"-"<<endl;
cin>>grds[i];
}
for(int i=10;i<=14;i++)
{ cout<<"Enter grade for Quiz "<<i-9<<"-"<<endl;
cin>>grds[i];
}
cout<<"Enter grade for Midterm -"<<endl;
cin>>grds[15];
cout<<"Enter grade for Final -"<<endl;
cin>>grds[16];
for(int j=0;j<=16;j++)
{
sum=sum+grds[j];
}
gpa=sum/16.00;
cout<<"Your GPA is-"<<gpa;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.