Respuesta :
Answer: Provided in the explanation section
Explanation:
Source Code:
using System;
//class Assignment3C
class Assignment3C {
//main function
static void Main() {
//getting userinputs
Console.WriteLine("Quiz Average:");
int quizAverage = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Test 1:");
int test1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Test 2:");
int test2 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Test 3:");
int test3 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Final Test:");
int finalTest = Convert.ToInt32(Console.ReadLine());
//cehcking whether the score is equal to 0 ; if so relpace it with the final score
if(test1 == 0 || test2 == 0 || test3 ==0){
if(test1 == 0){
test1 = finalTest;
Console.WriteLine("Zero from Test 1 is replaced with a "+finalTest);
}
if(test2 == 0 ){
test2 = finalTest;
Console.WriteLine("Zero from Test 2 is replaced with a "+finalTest);
}
if(test3 == 0){
test3 = finalTest;
Console.WriteLine("Zero from Test 3 is replaced with a "+finalTest);
}
}
else
{
//Assume test 1 is minimum sccore
int min = test1;
if(test2 < min){
min = test2;
}
if(test3 < min){
min = test3;
}
// Replace the minimum test scores by finalTest score
if(test1 == min)
{
test1 = finalTest;
Console.WriteLine("Final Test replaces Test 1");
}
if(test2 == min)
{
test2 = finalTest;
Console.WriteLine("Final Test replaces Test 2");
}
if(test3 == min)
{
test3 = finalTest;
Console.WriteLine("Final Test replaces Test 3");
}
}
//calculating average score
int average = (quizAverage + test1 + test2 + test3) / 4;
Console.WriteLine("Overall grade is a "+average);
}
}