Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that calculates a student\'s GPA based on 2 test 3 homework scor

ID: 3694578 • Letter: W

Question

Write a program that calculates a student's GPA based on 2 test 3 homework scores. Your program should have two functions: void getScore()and int cak Average (int,int,int,int,int) void getScore() asks the user for test and homework scores and validates them(between 0-100)double calcAverage() - should calculate and return the average of the scores from man where it will be printed The GPA of the student should be calculated using the following formula GPA = 0 75 * ((test1 +test2)/2) + 0 25 * homework 1 + homework 2 + home work 3/3) All scores should be entered as grade out of 100 possible points Test1 80 Test2 80 HW1 60 HW2 50 HW3 40

Explanation / Answer

#include <bits/stdc++.h>
using namespace std;
int test1,test2,hw1,hw2,hw3;
void getScore(){
   cout<<"Test1: ";
   cin>>test1;
   cout<<"Test2: ";
   cin>>test2;
   cout<<"Hw1: ";
   cin>>hw1;
   cout<<"Hw2: ";
   cin>>hw2;
   cout<<"Hw3: ";
   cin>>hw3;
   if(test1<=100 && test1>=0 && test2<=100 && test2>=0 && hw1<=100 && hw1>=0 && hw2<=100 && hw2>=0 && hw3<=100 && hw3>=0 ){
       cout<<"Invalid scores" <<endl;
   }
}

double calcAverage(int test1,int test2,int hw1,int hw2,int hw3){
   return 0.75*((test1+test2)/2.0)+0.25*((hw1+hw2+hw3)/3.0);
}

int main(){
   getScore();
   cout<<"GPA = "<<calcAverage(test1,test2,hw1,hw2,hw3)<<endl;
   return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote