In: Computer Science
C# Programming Language
Write a C# program ( Console or GUI ) that prompts the user to enter the three examinations ( test 1, test 2, and test 3), homework, and final project grades then calculate and display the overall grade along with a message, using the selection structure (if/else). The message is based on the following criteria:
using System;
class HelloWorld {
static void Main() {
double test1,test2,test3,homework,finalproject,finalgrade;
Console.WriteLine("Enter test 1 grade mark");
test1= Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter test 2 grade mark");
test2= Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter test 3 grade mark");
test3= Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter homework grade mark");
homework= Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter finalproject grade mark");
finalproject= Convert.ToDouble(Console.ReadLine());
finalgrade=(test1+test2+test3+homework+finalproject)/5;
if (finalgrade >= 90)
{
Console.WriteLine("Excellent");
}
else if (80<= finalgrade && finalgrade< 90)
{
Console.WriteLine("Good");
}
else if(70<= finalgrade && finalgrade <80)
{
Console.WriteLine("Above Average");
}
else if(60<= finalgrade && finalgrade <70)
{
Console.WriteLine("Average");
}
else if(finalgrade <60)
{
Console.WriteLine("Poor");
}
}
}