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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

this is the program, only problem is that I am not able to get Your total is 22 out of 30, or 73.33%. this statment, can you please help?

 

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;
}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Constants and Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education