Question

In: Computer Science

please i want solution for this question with algorithm and step by step with c++ language...

please i want solution for this question with algorithm and step by step with c++ language

  1. write a program using for loop 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%.

Solutions

Expert Solution

#include <iostream>

using namespace std;

int main() {

int n, score = 0,score_var, total_var, total = 0;

cout << "How many exercises to input? ";

cin>>n;

for(int i = 1; i<=n ; ++i){

cout<<"Score received for exercise "<<i<<": ";

cin>>score_var;

cout<<"Total points possible for exercise "<<i<<": ";

cin>>total_var;

score = score + score_var;

total = total + total_var;

cout<<endl<<endl;

}

cout<<"Your total is "<<score<<" out of "<<total<<", or "<<score*100.0/total<<" %"<<endl;

}

============================================================
SEE OUTPUT


Algorithm Score( )

START

1. Read number of exercises , Read(n)

2. For loop from i = 1 to n
read score for execise i
read total for execise i

Keep summing total ans score read from user

3. Once Loop ends, print the score, total and percentage

END

Thanks, PLEASE COMMENT if there is any concern. PLEASE UPVOTE

WHILE LOOP

#include <iostream>

using namespace std;

int main() {

int n, score = 0,score_var, total_var, total = 0, i = 1;

cout << "How many exercises to input? ";

cin>>n;

while(i<=n){

cout<<"Score received for exercise "<<i<<": ";

cin>>score_var;

cout<<"Total points possible for exercise "<<i<<": ";

cin>>total_var;

score = score + score_var;

total = total + total_var;

cout<<endl<<endl;

++i;

}

cout<<"Your total is "<<score<<" out of "<<total<<", or "<<score*100.0/total<<" %"<<endl;

}


Related Solutions

I want this program written in JAVA with the algorithm(The step by step process for the...
I want this program written in JAVA with the algorithm(The step by step process for the problem) . Please help it is due in a couple of hours. I don't want the C++ program, I want it in JAVA please #20 Theater Ticket Sales Create a TicketManager class and a program that uses it to sell tickets for a single performance theater production. Here are the specifications: • The theater's auditorium has 15 rows, with 30 seats in each row....
please I want it to step by step and in word posted so I can read...
please I want it to step by step and in word posted so I can read them. Q: If the average realized return of a portfolio is 27.5% per year, the standard deviation of returns is 50%, the portfolio beta is 1.25, the average return of Treasury bills over the same period is 2.5% per year, and the average return on the market is 12.5% per year Calculate i) the Sharpe; ii) Treynor and iii) Jensen    
This is a two part solution. Please include step by step solution that way I can...
This is a two part solution. Please include step by step solution that way I can study from this. Thank you. Equation (24.2): 3I^-(aq) + H2O2(aq) + 2H3O^+(aq) ---> I3^-(aq) + 4H2O(l) Equation (24.11): 2 S2O3^2-(aq) + I3^-(aq) ---> 3 I^-(aq) + S4O6^2-(aq) Part 1: Add equations 24.2 and 24.11 together.What happens to I-1 and I3-1? What should happen to their concentrations while S2O3-2 is present? Inspect equations 24.2 and 24.11 again. What will happen to the concentration of I3-1...
Please Provide the solution in java, already have a question which is answer in C++. Language:...
Please Provide the solution in java, already have a question which is answer in C++. Language: java. Please don't provide your email for private answer. Q1. Implement a program which allows the user to find the shortest path between two nodes in a graph possibly passing through a third node. I.e. the user should be able to ask questions like: Which is the shortest path from A to B passing through C? The program should output an ordered list of...
I would like to get the step by step solution for the below question Question 11...
I would like to get the step by step solution for the below question Question 11 pts What is the difference between positive economics and normative economics? Group of answer choices Positive economics deals with dynamic systems, while normative economics focuses on static systems. Normative economics deals with how the world actually works, whereas positive economics focuses on what people ought to do. Positive economics requires making value judgments, while normative economics relies solely on factual statements. Normative economics applies...
I want solve this question step by step, and write by pc Solomon is a principal...
I want solve this question step by step, and write by pc Solomon is a principal engineer at an environmental engineering consulting firm. His main role is to advise clients on what type of action to take when they are faced with risks and liabilities while conducting certain projects. In one case, Solomon had a client that wanted to expand their campus until it was within approximately 50 meters of a marshland. After construction of this extension, however, the client...
(Can you answer my question by explaining, I mean that step by step. I don't want...
(Can you answer my question by explaining, I mean that step by step. I don't want a short answer. Be sure to I like it if you write step by step For Design and Analysis of the Algorithme lecture) Peak Finding Implement the 2-D peak finder mentioned and explain the asymptotic complexity of the algorithm.
Calculate the pH of each aqueous solution: I need step to step solution please using formula...
Calculate the pH of each aqueous solution: I need step to step solution please using formula from; pH = -log [H3O+] pOH = -log[OH-] pH + pOH = 14 1)0.80 M lactic acid and 0.40 M lactate ion. 2) 0.10 mol of formic acid, HCOOH, and 0.10 mol of sodium formate, HCOONa in 1 L of water . 3) 0.30 M NH3 and 1.50 M NH4+
In C language Please display results The Euclidean algorithm is a way to find the greatest...
In C language Please display results The Euclidean algorithm is a way to find the greatest common divisor of two positive integers, a and b. First let me show the computations for a=210 and b=45. Divide 210 by 45, and get the result 4 with remainder 30, so 210=4·45+30. Divide 45 by 30, and get the result 1 with remainder 15, so 45=1·30+15. Divide 30 by 15, and get the result 2 with remainder 0, so 30=2·15+0. The greatest common...
The following is for C programming language: I want to scan for initials in a line...
The following is for C programming language: I want to scan for initials in a line of text. my line of text is as follows: 12345 3.5000 a j 12346 4.1000 s p The first number represents the student ID, the second number represents the gpa, the third character represents the first initial and the fourth character represents the last initial of the student. My text file contains these values. The following is my code: fscanf(fp, "%d %c %c", &studentID,...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT