Review the following scenario and complete the design. Scenario Professor Higgin
ID: 3577943 • Letter: R
Question
Review the following scenario and complete the design. Scenario Professor Higgins has asked you to design the logic that will be used to calculate final class averages and grades for his students. His grading algorithm is as follows. Exam average: 50% Quiz average: 25% Lab average: 25% The program will then determine the letter grade for each student using the following criteria. 90–100: A 80–89: B 70–79 C 60–69 D Less than 59 F Write a program using C#, prompt the user for the appropriate input, and display the output as described above. You may assume all data are valid. Provide a program introduction message that tells the user how to use the program.
Explanation / Answer
using System.IO;
using System;
class Program
{
static void Main()
{
Console.WriteLine( "Enter Exam average: " );
Double examAverage = Convert.ToDouble(Console.ReadLine());
Console.WriteLine( "Enter Quiz average: " );
Double quizAverage = Convert.ToDouble(Console.ReadLine());
Console.WriteLine( "EnterLab average: " );
Double labAverage = Convert.ToDouble(Console.ReadLine());
Double score = examAverage + quizAverage + labAverage;
if(score >= 90 && score <=100){
Console.WriteLine("Letter grade: A");
}
else if(score >= 80 && score <90){
Console.WriteLine("Letter grade: B");
}
else if(score >= 70 && score <80){
Console.WriteLine("Letter grade: C");
}
else if(score >= 60 && score <70){
Console.WriteLine("Letter grade: D");
}
else{
Console.WriteLine("Letter grade: F");
}
}
}
Output:
sh-4.3$ mcs *.cs -out:main.exe
sh-4.3$ mono main.exe
Enter Exam average:
45
Enter Quiz average:
24
EnterLab average:
19
Letter grade: B
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.