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

Write a program that gets an unspecified number of student ID numbers and averag

ID: 3573698 • Letter: W

Question

Write a program that gets an unspecified number of student ID numbers and average from the user and writes the ID numbers, averages and letter grades eared to the file specified by the user and displays the number of students whose data was the average of the student average and a histogram showing the grade distribution on the computer screen. Student ID numbers are non-negative whole numbers greater than 0 Student averages will real numbers. The user will enter an ID number of 0 to signal the end of input. The output se created will contain student IDs, averages and letter grades in the following format Your program must allow the user to enter the name of the file where the output data is to be stored You must use at last array in your program (you may use more than one) The required array will store a count of the students with 'A' average 'B' average 'C' averages. 'D' average and 'F' average Your program must consist of at least four meaningful function (you may have more than four and main does court towards the four) One of the required functions will be called The getAverage function will get a non-negative double value from the that is a student's average. Another required function is assignLetterGrade. The assignLetterGrade function will take an average as an argument and return the letter grade corresponding to the average that is the argument. You must implement the functions as prototyped below. double getAverage() char assignLettarGrade(double avg) The grading scale used to assign leter grads to student average is as follows: Student Average > 90: letter grade= A 80 lessthanorequalto Student Average

Explanation / Answer

#include<iostream>
using namespace std;
double getAverage(int marks[], int n){
float sum = 0,avg;
int i;
for(i=0;i<n;i++){
sum = sum + marks[i];
}
avg = sum/n;
return avg;
}
char assignLetterGrade(double avg){
if(avg >= 90){
return 'A';
}else if(80<= avg < 90){
return 'B';
}else if(70<= avg < 80){
return 'C';
}else if(60<= avg < 70){
return 'D';
}else{
if(avg < 60){
return 'F';
}
}
}
int main(){
  
   int mark[5], i;
   double avg;
   cout<<"Enter marks obtained in Physics, Chemistry, Maths, CS, English :";
   for(i=0; i<5; i++){
       cin>>mark[i];
   }
   avg = getAverage(mark,5);
   cout << "Average Marks:" << avg << endl;
   cout << "Grade assigned is: " << assignLetterGrade(avg);
}

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