Hey, This si the question Write a program that accepts from the user homework 1,
ID: 3612360 • Letter: H
Question
Hey,This si the question
Write a program that accepts from the user homework 1, hw2, hw3,
midterm and final exam scores for up to 10 students. Declare 5 arrays,
one for each of hw1, hw2, hw3, midterm and final, to read in the scores
of the students. Use sentinel controlled loop and terminate accepting values
when the user enters -1 or the maximum number of students have been entered.
Display the average, standard deviation, largest, smallest and second smallest
of all five grading components in a tabular format.
The output should look like this for 10 students.
************ Accepted Student Count = 10 *************
Homework1 Homework2 Homework3 MidTerm Final
========= ========= ========= ======= =====
Average 52.60 53.90 61.50 53.80 61.20
Std.Dev 32.30 31.25 32.04 37.94 38.00
Largest 100 100 100 100 100
Largest2 81 81 99 92 99
Smallest 0 0 0 0 0
Smallest2 21 23 33 1 1
========================================================================
Total Grade Letter Grade
=========== ============
Student # 1 100.00 A+
Student # 2 59.00 F
Student # 3 60.00 D
Student # 4 81.00 B-
Student # 5 58.30 F
Student # 6 50.20 F
Student # 7 59.40 D
Student # 8 45.90 F
Student # 9 0.00 F
I can't do this with arrays. I am posting my work whihc can only do the calculation for one student.
int main(){
// Declaring variables and asking user to enter the following information
int Hw1, Hw2, Hw3, Midterm, Final;
double hw1,hw2,hw3,mt,final,total;
cout<<"Please enter points scored in Homework 1"<<" :";
cin>>Hw1;
cout<<"Please enter points scored in Homework 2"<<" :";
cin>>Hw2;
cout<<"Please enter points scored in Homework 3"<<" :";
cin>>Hw3;
cout<<"Please enter points scored in Midterm"<<" "<<" :";
cin>>Midterm;
cout<<"Please enter points scored in Final"<<" "<<" :";
cin>>Final;
// Setting each homework to 10%
hw1=(Hw1*0.1);
hw2=(Hw2*0.1);
hw3=(Hw3*0.1);
//Setting midterm to 30%
mt=(Midterm*0.3);
//Setting final to 40%
final=(Final*0.4);
//Calculating total by adding all the assignments.
total=(hw1+hw2+hw3+mt+final);
//Printing out final data
cout<<" ";
cout<<"Hw1 "<<"Hw2 "<<"Hw3 "<<"Mid-Term"<<" Final"<<" Total";
cout<<" "<< Hw1 <<" "<< Hw2<<" "<< Hw3<<" "<< Midterm <<" "<<" "<< Final <<" "<< total;
cout<<" Overall Grade: " << total <<" out of 100 ";
if(total>=97)
cout<<" Your letter grade is: A+ ";
if((total<97)&&(total>=92))
cout<<"Your letter grade is: A ";
if((total<92)&&(total>=90))
cout<<"Your letter grade is: A- ";
if((total<90)&&(total>=88))
cout<<"Your letter grade is: B+ ";
if((total<88)&&(total>=82))
cout<<"Your letter grade is: B ";
if((total<82)&&(total>=80))
cout<<"Your letter grade is: B- ";
if((total<80)&&(total>=78))
cout<<"Your letter grade is: C+ ";
if((total<78)&&(total>=72))
cout<<"Your letter grade is: C ";
if((total<72)&&(total>=70))
cout<<"Your letter grade is: C- ";
if((total<70)&&(total>=68))
cout<<"Your letter grade is: D+ ";
if((total<68)&&(total>=60))
cout<<"Your letter grade is: D ";
if(total<60)
cout<<"Your letter grade is: E ";
system("pause");
return 0;
}
I will definitely rate you for this!! Please help me out!
Student #10 60.40 D