Write program in C that does Take student name Take his home

Write program in C++ that does: Take student name Take his homework1, homework2, homework3, and homework4 grades. Take his quiz1, quiz2, quiz3, and quiz4 grades. Take his Midterm1, and Midterm2 grades. Take his final exam grade Calculate the average of homework Calculate the average of homework Calculate the final exam grade: final grade = average of homework x 0.10 + average of quiz x0.10 + Midterm1 x 0.20 + Mtdterm2 x 0.20 + final exam x 0.040 Output the student name. Output the final grade. Output word \"Pass\" if the grade equal and more the 60, and output word \"failed\" if the grade less then 60

Solution

Please find the required program along with its output. Please see the comments against each line to understand the step.

// Example program
#include <iostream>
#include <string>

using namespace std;

int main()
{
string name;
double hw1, hw2, hw3, hw4, q1, q2, q3, q4, m1, m2, f, avghw, avgq, fs; //initialize variables
cout << \"Enter student name: \" <<endl;
cin >> name; //read name
  
cout << \"Enter homework 1 score: \" << endl; //read homework grades
cin >> hw1;
cout << \"Enter homework 2 score: \" << endl;
cin >> hw2;
cout << \"Enter homework 3 score: \" << endl;
cin >> hw3;
cout << \"Enter homework 4 score: \" << endl;
cin >> hw4;

cout << \"Enter quiz 1 score: \" << endl; //read quiz grades
cin >> q1;
cout << \"Enter quiz 2 score: \" << endl;
cin >> q2;
cout << \"Enter quiz 3 score: \" << endl;
cin >> q3;
cout << \"Enter quiz 4 score: \" << endl;
cin >> q4;
  
cout << \"Enter midterm 1 score: \" << endl; //read midterm grades
cin >> q1;
cout << \"Enter midterm 2 score: \" << endl;
cin >> q2;
  
cout << \"Enter final exam score: \" << endl; //read final exam grade
cin >> f;


avghw = (hw1 + hw2 + hw3 + hw4)/4; //calculate homework average
  
avgq = (q1 + q2 + q3 + q4)/4; //calculate quiz average
  
fs = (avghw * 0.10) + (avgq * 0.10) + (m1 * 0.20) + (m2 * 0.20) + (f * 0.40); //calculate final grade
  
cout << \"Student : \" << name << endl; //print name
cout << \"Final grade : \" << fs << endl; //print final grade
  
if(fs >= 60) //if final grade >= 60, then print pass
cout << \"Pass\" << endl;
else //else print failed
cout << \"failed\" << endl;

  
}

-------------------------------------------------------------

OUTPUT:

 Write program in C++ that does: Take student name Take his homework1, homework2, homework3, and homework4 grades. Take his quiz1, quiz2, quiz3, and quiz4 grade
 Write program in C++ that does: Take student name Take his homework1, homework2, homework3, and homework4 grades. Take his quiz1, quiz2, quiz3, and quiz4 grade

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site