Answer to Question #98809 in C++ for Syed Mohib Ali

Question #98809
Write a program that enter the marks obtained Homework, assignment and test with weight age.
Homework=0.2 Assignment=0.3 Test=0.5
If net marks are more than 60%,print pass, otherwise fail
1
Expert's answer
2019-11-17T12:53:05-0500
#include "iostream"
using namespace std;

float Result(float home, float assig, float test)
{
	return  (home/5+assig*3/10+test/2);
}

int main()
{
	float maxim_rating;
	cout << "Enter a maximum rating: ";
	cin >> maxim_rating;
	float home, assig, test;
	cout << "\nEnter a mark for a homework: ";
	cin >> home;
	cout << "Enter a mark for an assigment: ";
	cin >> assig;
	cout << "Enter a mark for a test: ";
	cin >> test;
	float result = Result(home, assig, test);
	cout << "Your total result is: " << (result/maxim_rating)*100 << "%"<<endl;
	if (result < maxim_rating*6/10)
	{
		cout << "You fail." << endl;
	}
	else
	{
		cout << "You pass." << endl;
	}
	system("pause");
	return 0;
}

In this case the maximum rating is entered in the beginning of a program.


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
APPROVED BY CLIENTS