In: Computer Science
A Class assessment is based on Three Examinations, Homework and a Final Project. The weight for each category is as follows: Ex 1, Ex 2 and Ex 3 Weight 45% of the overall grade, Homework Weight 25% and Final Project Weight 30%.
Write a C# program ( Console or GUI ) that prompts the user to enter the three examinations ( ex1, ex 2, and ex 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:
Solution:
Code:
Output:
Copyable Code:
using System;
//Main class
class MainClass {
//Main method
public static void Main (string[] args)
{
//Declaration of variables
double ex1,ex2,ex3,homework,finalProject,totGrade=0;
//Prompt and get from users
Console.Write("Enter the Grade for Examination 1:");
ex1 = double.Parse(Console.ReadLine());
Console.Write("Enter the Grade for Examination 2:");
ex2 = double.Parse(Console.ReadLine());
Console.Write("Enter the Grade for Examination 3:");
ex3 = double.Parse(Console.ReadLine());
Console.Write("Enter the Grade Homework:");
homework = double.Parse(Console.ReadLine());
Console.Write("Enter the Grade Final Project:");
finalProject = double.Parse(Console.ReadLine());
//Calculation of grade
totGrade=(((ex1+ex2+ex3)*(0.45))+(homework*(0.25))+(finalProject*(0.30)));
//Conditions
if(totGrade>=90)
{
//Print statement
Console.Write("Excellent:Your Grade is {0}.",totGrade);
}
else if(totGrade>=80 && totGrade<90)
{
//Print statement
Console.Write("Good:Your Grade is {0}.",totGrade);
}
else if(totGrade>=70 && totGrade<80)
{
//Print statement
Console.Write("Above Average:Your Grade is {0}.",totGrade);
}
else if(totGrade>=60 && totGrade<70)
{
//Print statement
Console.Write("Average:Your Grade is {0}.",totGrade);
}
else
{
//Print statement
Console.Write("Poor:Your Grade is {0}.",totGrade);
}
}
}