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

Write a program that allows the user to enter the percentage grade of 30 student

ID: 3694097 • Letter: W

Question

Write a program that allows the user to enter the percentage grade of 30 students in a class. The program should have the following conditions: Make sure the user enter 30 valid percentage grades between 0 and 100. If the user enter out of rage value, the program should show the error message "Not correct grade in percentage scale" and don't use that grade. By entering each grade in percentage, the program should show the corresponding grade, GPA, and grade definition at the output screen according to the following screen. After the user finish entering the grades, the program should show the number of students and the average GPA of students In each six grade definitions. Finally program should show the average GPA of all students in percentage scale [0-100] and GPA scale 10-4],

Explanation / Answer

#include <iostream>

using namespace std;

int main()
{
int perc[30]; // required values
int i;
float agpa=0;
for(i=0;i<30;i++) // loop through 30 students
{
cout<<"Enter grade percentage: ";
cin>>perc[i]; // reading percentage from user
if(perc[i]<=100 && perc[i] >=0) // if else for the percentage grade values
{
if(perc[i]>=90)
{
cout<<"Grade : A+ ";
cout<<"GPA : 4.0 ";
cout<<"You are outstanding ";
}
else if(perc[i]>=85)
{
cout<<"Grade : A ";
cout<<"GPA : 4.0 ";
cout<<"You are exceptional ";
}
else if(perc[i]>=80)
{
cout<<"Grade : A- ";
cout<<"GPA : 3.7 ";
cout<<"You are exceptional ";
}
else if(perc[i]>=77)
{
cout<<"Grade : B+ ";
cout<<"GPA : 3.3 ";
cout<<"You are Good ";
}
else if(perc[i]>=73)
{
cout<<"Grade : B ";
cout<<"GPA : 3.0 ";
cout<<"You are Good ";
}
else if(perc[i]>=70)
{
cout<<"Grade : B- ";
cout<<"GPA : 2.7 ";
cout<<"You are Good ";
}
else if(perc[i]>=67)
{
cout<<"Grade : C+ ";
cout<<"GPA : 2.3 ";
cout<<"Adequate ";
}
else if(perc[i]>=63)
{
cout<<"Grade : c ";
cout<<"GPA : 2.0 ";
cout<<"Adequate ";
}
else if(perc[i]>=60)
{
cout<<"Grade : C- ";
cout<<"GPA : 1.7 ";
cout<<"Adequate ";
}
else if(perc[i]>=57)
{
cout<<"Grade : D+ ";
cout<<"GPA : 1.3 ";
cout<<"Marginal ";
}
else if(perc[i]>=53)
{
cout<<"Grade : D ";
cout<<"GPA : 1.0 ";
cout<<"Marginal ";
}
else if(perc[i]>=50)
{
cout<<"Grade : D ";
cout<<"GPA : 0.7 ";
cout<<"Marginal ";
}
else
{
cout<<"Grade : F ";
cout<<"GPA :0.0 ";
cout<<"Fail ";
}
  
  
}
else // validating the user input
{
cout<<"Enter correct percentage of grade ";
cout<<"We do not use this percentage. ";
i=i-1; // back step in the loop to store the correct value
}
  
}
cout<<"Total number of students: 30"; // printing average Gpa of 30 students
for(i=0;i<30;i++)
{
if(perc[i]>=90)
{
agpa=agpa+4.0;
}
else if(perc[i]>=85)
{
agpa=agpa+4.0;
}
else if(perc[i]>=80)
{
agpa=agpa+3.7;
}
else if(perc[i]>=77)
{
agpa=agpa+3.3;
}
else if(perc[i]>=73)
{
agpa=agpa+3.0;
}
else if(perc[i]>=70)
{
agpa=agpa+2.7;
}
else if(perc[i]>=67)
{
agpa=agpa+2.3;
}
else if(perc[i]>=63)
{
agpa=agpa+2.0;
}
else if(perc[i]>=60)
{
agpa=agpa+1.7;
}
else if(perc[i]>=57)
{
agpa=agpa+1.3;
}
else if(perc[i]>=53)
{
agpa=agpa+1.0;
}
else if(perc[i]>=50)
{
agpa=agpa+0.7;
}
else
{
agpa=agpa+0.0;
}
  
  
}
agpa=agpa/3;
cout<<"Average GPA of all studens is:"<<agpa;
if(agpa>=3.5)
{
cout<<"average grade:outstanding & exceptional";
}
else if(agpa>=2.7)
{
cout<<" average grade: Good";
}
else if(agpa>=1.5)
{
cout<<"average grade : OK";
}
else if(agpa>=0.7)
{
cout<<"just passed ";
}
  
else
{
cout<<"Fail";
}

}

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