Question

C++ Write a program that calculates and prints the total grade for n assignments as a...

C++

Write a program that calculates and prints the total grade for n assignments
as a percentage. Prompt the user to enter the value of n, followed by the number
of points received and number of points possible for each assignment . Calculate
and print the total number of points received, total number of points possible,
and the overall percentage: (total points received / total points possible) * 100.

Output:

Enter·number·of·assignments·to·input:3↵

Enter·number·of·points·received·for·assignment·1 :10↵

Enter·number·of·possible·points·for·assignment·1 :10↵

Enter·number·of·points·received·for·assignment·2 :7↵

Enter·number·of·possible·points·for·assignment·2 :12↵

Enter·number·of·points·received·for·assignment·3 :5↵

Enter·number·of·possible·points·for·assignment·3 :8↵

our·total·amount·of·points·is·22·out·of·30,·or·73.33%.↵

Homework Answers

Answer #1

Program:

#include<iostream>
#include<iomanip>
using namespace std;

int main()
{
   int n;
   int totalPointsReceived=0, totalPointsPossible=0;
   double overallPercentage;
   int pointsReceived,pointsPossible;
  
   //prompt and read the number of assignments
   cout<<"\nEnter number of assignments to input: ";
   cin>>n;
  
   //run a loop to read n number of point
   for(int i=0;i<n;i++)
   {
       //prompt and read points received
       cout<<"\nEnter number of points received for assignment "<<(i+1)<<" : ";
       cin>>pointsReceived;
      
       //prompt and read points possible
       cout<<"\nEnter number of possible points for assignment "<<(i+1)<<" : ";
       cin>>pointsPossible;
      
       //add the points to totalPointsReceived
       totalPointsReceived=totalPointsReceived+pointsReceived;
      
       //add the points to totalPointsPossible
       totalPointsPossible=totalPointsPossible+pointsPossible;
   }
  
   //calculate the overall percentage
   overallPercentage = ((double)totalPointsReceived / (double)totalPointsPossible) * 100.00;
  
   //print the output
   cout<<"\nOur total amount of points is "<<totalPointsReceived<<" out of "<<totalPointsPossible<<" or "<<setprecision(4)<<overallPercentage<<"%";
   return 0;
}

Output:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write most basic C++ program possible that calculates monthly savings account balance. Program will prompt user...
Write most basic C++ program possible that calculates monthly savings account balance. Program will prompt user to enter initial account balance, annual percentage rate, amount deposited each month, and total number of months. Validate user inputs allowing only positive numbers. B = initial account balance A = amount deposited each month R = annual percentage rate Total Balance = (R/12+1)B+A
* Write a Java program that calculates and displays the Fibonacci numbers * First prompt the...
* Write a Java program that calculates and displays the Fibonacci numbers * First prompt the user to input a number, N * Then use a for loop to calculate and display the first N fibonocci numbers * For example, if the user enters 5, the output should be: * 1, 1, 2, 3, 5 * * if the user enters 10, the output should be: * 1, 1, 2, 3, 5, 8, 13, 21, 34, 55
In Python... Write a program that calculates a student’s final grade in this course. The program...
In Python... Write a program that calculates a student’s final grade in this course. The program should: Display a message stating its goal Prompt the user to enter a student’s average grade for the weekly assignments, grade for mid-course project and grade for final project Calculate the final grade based on these percentages... Assignments = 60% Mid-course & Final Project = 40% (20% each) A A- B+ B B- C+ C C- D+ D D- E 100-94 93-89 88-85 84-82...
Write a Java program that gets a 4x4 array of numbers and that calculates the sum...
Write a Java program that gets a 4x4 array of numbers and that calculates the sum and average of numbers on the main diagonal, ie the diagonal that goes from the left corner down to the right corner. Examples of resulting programs are: Enter a 4x4 matrix row by row: 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 The sum of numbers in the diagonal is: 16 The average of numbers in...
Please use Python 3 4). Write a program that asks the user to enter 10 numbers....
Please use Python 3 4). Write a program that asks the user to enter 10 numbers. The program should store the numbers in a list and then display the following data: • The lowest number in the list • The highest number in the list •The total of the numbers in the list • The average of the numbers in the list   Sample input & output: (Prompt) Enter Number 1: (User enter) 4 (Prompt) Enter Number 2: (User enter) 7...
5) Create a Java program using Scanner: Write a program where you will enter the grade...
5) Create a Java program using Scanner: Write a program where you will enter the grade score for 5 classes, then it will display total points and average and it will display the grade based on percentage. Steps: 1) Declare variable integer for English, Chemistry, Java Programming, Physics and Math 2) Declare variable total and percentage 3) Create Scanner object and prompt the user to enter grades for each class and input grades after each class 4) Calculate total of...
Assembler lanaguage program   The program is to prompt the user to enter a number between 2...
Assembler lanaguage program   The program is to prompt the user to enter a number between 2 and 100. Reject any invalid user inputs and terminate the program if invalid inputs are entered. Print each even number from 2 to the user entered number. Sum these even numbers and print the sum. Print each odd number from 1 to the user entered number. Sum these odd numbers and print the sum. Exit the program when the output is complete. The output...
1)Write a program that asks a user for a number. If (and only if) the number...
1)Write a program that asks a user for a number. If (and only if) the number is greater than zero print “The number is valid” 2)Write a program that asks a user for a grade. If (and only if) the grade is greater than zero and less than 101, print “The grade is valid” 3)Write a program that asks a user how many widgets they want to buy and prints out what the user should pay. Widgets costs 10 dollars....
Write a program that asks the user to enter an odd number and prints out a...
Write a program that asks the user to enter an odd number and prints out a triangle pattern. For example, if the user enters 5, the output is note: There is one space between the numbers in each line 1 3 5 1 3 1 If the user enters 9 the output is: 1 3 5 7 9 1 3 5 7 1 3 5 1 3 1 program language: C++
in c++ Write a C++ program that asks the user to enter an integer number and...
in c++ Write a C++ program that asks the user to enter an integer number and prints it back "vertically" to the screen. Use recursion in your solution. As an example of how the program will work: Please enter an integer: 12345 The integer you entered will print vertically as: 1 2 3 4 5
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT