Write a program that calculates the total grade for N classroom exercises as a percentage. The user should input the value for N followed by each of the N scores and totals. Calculate the overall percentage (sum of the total points earned divided by the total points possible) and output it as a percentage. Sample input and output is shown below. How many exercises to input? 3 Score received for exercise 1: 10 Total points possible for exercise 1: 10 Score received for exercise 2: 7
this is the
13.Write a program that calculates the total grade for N classroom exercises
as a percentage. The user should input the value for N followed by each of
the N scores and totals. Calculate the overall percentage (sum of the total
points earned divided by the total points possible) and output it as a percentage.
Sample input and output is shown below.
How many exercises to input? 3
Score received for exercise 1: 10
Total points possible for exercise 1: 10
Score received for exercise 2: 7
Total points possible for exercise 2: 12
Score received for exercise 3: 5
Total points possible for exercise 3: 8
Your total is 22 out of 30, or 73.33%.
my solution.
//declare variables
string exercise1;
string exercise2;
string exercise3;
string exercises;
string totalexercise1;
string totalexercise2;
string totalexercise3;
string yourtotal;
yourtotal = exercise1 + exercise2 + exercise3;
string outof;
outof = totalexercise1 + totalexercise2 + totalexercise3;
float total_points = 0;
float total_earned = 0;
//ask for user input
cout << "How many exercises to input :" << endl;
cin >> exercises;
cout << "Scores received for exercise 1 :" << endl;
cin >> exercise1;
cout << "Total points available for exercise 1 :" << endl;
cin >> totalexercise1;
cout << "Scores received for exercise 2 :" << endl;
cin >> exercise2;
cout << "Total points available for exercise 2 :" << endl;
cin >> totalexercise2;
cout << "Scores received for exercise 3 :" << endl;
cin >> exercise3;
cout << "Total points available for exercise 3 :" << endl;
cin >> totalexercise3;
outof = totalexercise1 + totalexercise2 + totalexercise3;
cout << "total out of :" << endl;
cout << " Yourtotal " << " outof :" << endl;
cin >> outof;
return 0;
}
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)