Answer to Question #222058 in C++ for sage

Question #222058

Program

Create a program that asks for the student's score and the number of items in a laboratory exercise. It will then compute for the grade using the formula.

Input

The user is required to enter two (2) inputs where the first input is the student score and the second one is the total number of items.

Output

The program will display the solution or formula (Score / Total # of Items) x 60 + 40 followed by an equal sign then the equivalent laboratory grade with two decimal places of the student. (Refer to the sample output)

++++++++++++++++++++++++++++++

Sample Input #1

15 20

Sample Output #1

(15/20)x60+40=85.00

++++++++++++++++++++++++++++++

Sample Input #2

21 40

Sample Output #2

(21/40)x60+40=71.50


1
Expert's answer
2021-08-01T00:29:17-0400
#include <iostream>
#include <iomanip>
using namespace std;


int main(){
	int score;
	int totalItems;
	cin>>score>>totalItems;
	float grade=((float)score / (float)totalItems) * 60 + 40;
	cout<<fixed<<"("<<score<<"/"<<totalItems<<")x60+40="<<setprecision(2)<<grade<<"\n";


	cin>>score;
	return 0;


}




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