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

Design and implement an algorithm to solve this problem; yoursolution should use

ID: 3609276 • Letter: D

Question

Design and implement an algorithm to solve this problem; yoursolution should use functions. Do not accessglobal variables. Use parameters! (Suggestions: int function todetermine lowest of two numbers, void function to print themessage) Use function prototypes; the source code for functionsshould follow the source code for the main function.

           Input a student’s full name and four integer scores

           Average the scores – drop the lowest grade; round to thenearest integer

                       Formula to drop the low grade: average = (sum of all 4 scores -lowscore) / 3

           Print out a message that includes the student name, average, andone of the following:

                                  Exceptional                 for averages >= 95

                                  Passing                       for 60 <= averages <95

                                  Gotta repeat it            for averages < 60.

After your program works correctly for one student, add a loopso the user can process any number ofstudents.

Explanation / Answer

#include<iostream.h>
#include <string>
using namespace std;
int inputgrade();
string inputname();
void output(int,string);
int lowest(int, int);
int average(int,int,int,int,int);

int main()
{string name;
int grade1,grade2,grade3,grade4,intaverage,i,low;
name=inputname();
while(name!="DONE")
{
   grade1=inputgrade();
   grade2=inputgrade();
   grade3=inputgrade();
   grade4=inputgrade();
   low=lowest(grade1,grade2);
   low=lowest(low,grade3);
   low=lowest(low,grade4);
  intaverage=average(grade1,grade2,grade3,grade4,low);
   output(intaverage,name);
   cin.ignore(1000,' ');
   name=inputname();
}
system("pause");
return 0;
}
string inputname(void)
{string name;
cout<<"Enter name-DONE to exit: ";
getline(cin,name);
return name;
}
int inputgrade()
{int grade;
cout<<"Enter grade: ";
cin>>grade;
return grade;
}
int lowest(int a,int b)
{if(a<b)
   return a;
else
   return b;
}
int average(int grade1,int grade2,int grade3,int grade4,intlow)
{int a;
a=(int)((grade1+grade2+grade3+grade4-low)/3.+.5);
return a;
}
void output(int a,string n)
{cout<<n<<" "<<a<<"    ";
if(a>=95)
   cout<<"Exceptional ";
else
   if(a>=60)
       cout<<"Passing ";
   else
       cout<<"Gotta repeatit ";
return;
}

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