Answer to Question #291642 in C++ for Aeyell

Question #291642

The program will ask the user to enter Midterm grades and final grades. Student final grades is 30% of midterm and 70% of final grades

1
Expert's answer
2022-01-28T15:17:33-0500
#include<iostream>

using namespace std;

int main()
{
	cout << "Please, enter Midterm grades(-1 - to stop): ";
	double mGrades;
	double sumMGrds = 0;
	int countMGrds=0;
	do
	{
		cin >> mGrades;
		if (mGrades < 0)break;
		sumMGrds += mGrades;
		countMGrds++;
	} while (true);


	cout << "Please, enter Final grades(-1 - to stop): ";
	double fGrades;
	double sumFGrds = 0;
	int countfGrds = 0;
	do
	{
		cin >> fGrades;
		if (fGrades < 0)break;
		sumFGrds += fGrades;
		countfGrds++;
	} while (true);
	double result = (double)(sumMGrds / countMGrds*0.3) + (sumFGrds / countfGrds*0.7);
	cout << "Result grade of student is " << result;
}	

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog