77 902
Assignments Done
98,6%
Successfully Done
In August 2019

# Answer to Question #48856 in C++ for ehab

Question #48856
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:
St_Nm ID First Second Final Average Grade
1 20071156 15.5 16.5 30.1 62.1 D
Expert's answer
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int ID;
double First, Second, Final, Total;
char Grade;
cout<<"Enter ID : ";
cin>>ID;
cout<<"Enter First mark : ";
cin>>First;
cout<<"Enter Second mark : ";
cin>>Second;
cout<<"Enter Final mark : ";
cin>>Final;
Total = First + Second + Final;
if (Total>=90 && Total <=100) Grade = 'A'; else if(Total >= 80 && Total < 90) Grade = 'B';
else if(Total >= 70 && Total < 80) Grade = 'C';
else if(Total >= 60 && Total < 70) Grade = 'D';
else Grade = 'F';
if(Total > 100)
{
Grade = '-';
Total = 0;
cout<<"There is an error! Total is over 100!"<<endl;
}
cout<<"St_Nm\t"<<"ID\t"<<"First\t"<<"Second\t"<<"Final\t"<<"Total\t"<<"Grade\t"<<endl;
cout<<"1"<<"\t"<<ID<<"\t"<<First<<"\t"<<Second<<"\t"<<Final<<"\t"<<Total<<"\t"<<Grade<<endl;
_getch();
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!

Submit