Write C++program that is to be used by university instructors to calculate the f
ID: 3854032 • Letter: W
Question
Write C++program that is to be used by university instructors to calculate the final grade for each student in their courses. In order to save time, we will generate the grades for the students (instead of inputting them) as follows: Each student has three grades: course work, mid, and final. Each mark is out of 100. The weight for the three marks are as follows: Course work = 35%, mid = 20%, & final = 45%. The program starts: 1. Asking the user (instructor) to input the number of students in the class. 2. Generating 3 grades for each student and stores them in three different array. 3. Compute the letter grade as follows: a. 90 & above = A b. 80 to 89 = B c. 70 to 79 = C d. 6O to 69 = D e. Below 60 = F The program output is a summary of the grades (i.e. the number of As, Bs, Cs, Ds, and Fs). The program terminates or (this is for an additional credit) ask the user if he/she wants to enter the grades for another course.Explanation / Answer
Answer for Question:
This below c++ code is written as per conditons in the problem statement.
See the below code for c++
#include<iostream>
using namespace std;
int main()
{
int student_count = 0;
double work[student_count], mid[student_count],final[student_count];
int i=0;
double total[student_count];
int c_a =0,c_b=0,c_c=0,c_d=0,c_f=0;
char ch = 'n';
do{
cout<<"Enter Number of students in a class:"<<endl;
cin>>student_count;
cout<<"Enter the grades to each student:"<<endl;
for(i=0;i<student_count;i++)
{
cout<<"Enter work marks:"<<endl;
cin>>work[i];
if(work[i]>35.0)
{
cout<<"Please re-enter mars below 35%"<<endl;
cin>>work[i];
}
cout<<"Enter mid marks:"<<endl;
cin>>mid[i];
if(mid[i]>20.0)
{
cout<<"Please re-enter marks below 20%"<<endl;
cin>>mid[i];
}
cout<<"Enter Final marks:"<<endl;
cin>>final[i];
if(final[i]>20.0)
{
cout<<"Please re-enter marks below 45%"<<endl;
cin>>final[i];
}
total[i] = work[i] + mid[i]+final[i];
}
for(i=0;i<student_count;i++)
{
if(total[i]>=90)
c_a++;
else if(total[i]<=89 && total[i]>=80)
c_b++;
else if(total[i]<=79 && total[i]>=70)
c_c++;
else if(total[i]<=69 && total[i]>=60)
c_d++;
else
c_f++;
}
cout<<"Total A Grade are:"<<c_a<<endl;
cout<<"Total B Grade are:"<<c_b<<endl;
cout<<"Total C Grade are:"<<c_c<<endl;
cout<<"Total D Grade are:"<<c_d<<endl;
cout<<"Total F Grade are:"<<c_f<<endl;
cout<<"You want's terminate the program or you want enter the grade for another course:"<<endl;
cin>>ch;
}while(ch !='y' || ch!='Y');
return 1;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.