Answer to Question #48996 in Engineering for salah abu zaid

Question #48996
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
Expert's answer
2014-11-18T00:45:59-0500
Answer on Question #48996,Engineering, Other


using System;
usingSystem.Collections.Generic;
using System.Linq;
using System.Text;

namespaceConsoleApplication45
{
class Program
{
static void Main()
{
int ID;
double First,Second,Final,Total;
char Grad;
int St_Nm;
Console.Write("enter number ofstudent ");
St_Nm =int.Parse(Console.ReadLine());

Console.Write("enterstudent ID ");
ID =int.Parse(Console.ReadLine());
Console.Write("enter firstmark ");
First =double.Parse(Console.ReadLine());
Console.Write("entersecond mark ");
Second =double.Parse(Console.ReadLine());
Console.Write("enter finalmark ");
Final = double.Parse(Console.ReadLine());
Total = First + Second + Final;
if (Total >= 90) Grad = 'A';
if ((Total >= 80) &&(Total < 90)) Grad = 'B';
if ((Total >= 70) &&(Total < 80)) Grad = 'C';
if ((Total >= 60) &&(Total < 70)) Grad = 'D';
else Grad = 'F';


Console.WriteLine("St_NmID First Second Final Average Grade");
Console.WriteLine(St_Nm +"\t" + ID + "\t" + First + "\t" + Second +
"\t" + Final + "\t" + Total + "\t" + Grad);


Console.ReadLine();
}
}
}

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!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS