63 213
Assignments Done
99,3%
Successfully Done
In July 2018

Answer to Question #25214 in C++ for kim

Question #25214
6. Due to poor results of your prelim examination, your teacher decides to increase each student’s grade by 5. Get all the grades and compute for the new grade. If the original grade exceeds 90, the grade remains as such. (grade.cpp)

Requirements:
Function for the input.
Function for the formula/process together with the output.

Sample Run:
Name: Eugerico
Grade: 80
Your new grade is 85
Do you want to enter another record [y/n]? y

Name: Laurence
Grade: 91
Your grade is still 91.
Do you want to enter another record [y/n]? y

Name: Ana
Grade: 76
Your new grade is 81

Do you want to enter another record [y/n]? n
Exit
Expert's answer
#include <iostream>

using namespace std;

int input_grade()
{
string name;
int grade;

cout << "Name: ";
cin >> name;

cout << "Grade: ";
cin >> grade;
return grade;
}

void new_grade(int grade)
{
if (grade > 90)
cout << "Your grade is still " << grade << "." << endl;
else
cout << "Your new grade is " << grade + 5 << "." << endl;
}

int main()
{
char choice;
do
{
new_grade(input_grade());
cout << "Do you want to enter another record [y/n]? ";
cin >> choice;
cout << endl;
}
while (choice == 'y');

cout << "Exit" << endl;
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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions