Question #48928

rite a program that can enter marks for 1 student and calculate his total and
grade with the following format
The inputs:
ID (As Integer), First (As Double), Second (As Double), Final (As Double), Total (As
Double) and Grad (As Char)
The Grades are: A for 90’s, B for 80’s, C for 70’s, D for 60’s and F for less than 60.
The output:
St_Nm ID First Second Final Average Grade
1 20071156 15.5 16.5 30.1 62.1 D
1

Expert's answer

2014-11-20T13:44:45-0500

Answer on Question #48928, Programming, C++

Task

Write a program that can enter marks for 1 student and calculate his total and grade with the following format

The inputs:

ID (As Integer), First (As Double), Second (As Double), Final (As Double), Total (As Double) and Grad (As Char)

The Grades are: A for 90's, B for 80's, C for 70's, D for 60's and F for less than 60.

The output:


Solution

#include <iostream>
using namespace std;
int main() {
int id;
double first, second, final, total;
char grade;
cout << "\nEnter the information about student:\n";
cout << "ID:";
cin >> id;
cout << "First:";
cin >> first;
cout << "Second:";
cin >> second;
cout << "Final:";
cin >> final;
total = first + second + final;
if (total >= 90) grade = 'A';
else if (total >= 80) grade = 'B';
else if (total >= 70) grade = 'C';
else if (total >= 60) grade = 'D';
else grade = 'F';
cout << "\nSt_Nm\tID\tFirst\tSecond\tFinal\tAverage\tGrade\n";
cout << id << "\t" << id << "\t" << first << "\t" << second << "\t" << final << "\t" << total << "\t" << grade;
cout << "\nFor exit enter any symbol\n";
cin >> id;
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 the first!
LATEST TUTORIALS
APPROVED BY CLIENTS