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

Write a program that will ask the user to enter 4 quiz scores for 3 students. Yo

ID: 3769421 • Letter: W

Question

Write a program that will ask the user to enter 4 quiz scores for 3 students. You will need to fine the lowest quiz grade and drop it out when you calculate the average. You will need to display all 4 quiz scores for each student as well as the lowest score and the average. Don’t forget to validate the scores when you get them. Don’t forget to drop the lowest score in your calculation. You can assume that all quizzes will be out of 10pts.

Requirements: - Need to create a 2D array for the scores - Need 2 1D arrays for lowest score and average

Input: - Quiz scores for each student EX:

7 8 3 9

6 7 4 8

9 5 3 3

Output: -

All four scores, the lowest, and the average score EX:

Q1 Q2 Q3 Q4 Low Avg

7 8 3 9 3 8.0

6 7 4 8 4 7.0

9 5 3 3 3 5.7

Functions:

- int findMin(int student, int scores[3][4])

o Finds the minimum quiz score for any given student

o Returns the minimum

- void printTable(int scores[3][4], int min[3], int avg[3])

o Prints the output to the screen

- float getAverage(int student, int min, int scores[3][4])

o finds the average of the 3 quiz scores for a given student

• ignores the minimum score

o returns the average

* You must use the functions EXACTLY

Explanation / Answer

#include <iostream>
#include <iomanip>
using namespace std;

int findMin(int student, int scores[3][4])
{int i;
int min=scores[student][0];
for(i=0 ;i<4;i++)
{
if(scores[student][i]<=min)
min= scores[student][i];
  
}
  
return min;

}
float getAverage(int student, int min, int scores[3][4])
{
float tot=0.0;
int i;
float average;
for(i=0 ;i<4;i++)
{
tot=tot+scores[student][i];
  
}
tot=tot-min;
average=tot/3.0;
return average;
}


void printTable(int scores[3][4], int min[3], float avg[3])
{
int i,j;
cout<<"Q1 "<<"Q2 "<<"Q3 "<<"Q4 "<<"Low "<<"Avg"<<endl;
for(i=0;i<3;i++)
{
  
for(j=0;j<4;j++)
{

cout<<scores[i][j]<<" ";
}
cout<<min[i]<<" "<<avg[i]<<endl;   
}


}
int main()
{
int scores[3][4];
int min[3]; float avg[3];
int i,j;

for(i=0;i<3;i++)
{
cout<<"Enter scores for "<<i+1<<"Student"<<endl;   
for(j=0;j<4;j++)
{

cin>> scores[i][j];
}
  
}
for(i=0;i<3;i++) {
min[i]=findMin(i, scores);
avg[i]=getAverage(i, min[i],scores);

  
}
printTable(scores, min, avg);
system("pause");   
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