Answer to Question #313239 in C# for Jayjay

Question #313239

COMPUTE GRADE PROGRAM

Create a function named StudeInfo that will accept the following values from the user:

StudentID, StudentName, Course, Age, PrelimGrade, MidtermGrade, FinalTermGrade.


Create a function named ComputeGrade that will compute Final Average which is computed as the sum of PrelimGrade, MidtermGrade and FinalTermGrade divided by 3.


Display the output with the following format: (sample output)

*************************************************************************************

Student ID : 00-00-01

Student Name : FERNAN W. AMMAQUI

____________________________________________________________________________________

PRELIM GRADE : 90.0

MIDTERM GRADE : 90.0

FINAL GRADE : 90.0

AVERAGE : 90.0

*************************************************************************************

Color the Student ID and Name values with green. Failing average will be colored with red. Otherwise, color it with blue.


1
Expert's answer
2022-03-17T09:37:16-0400
using System;


namespace MathApp


{
    class Program
    {
        public static void StudeInfo(string StudentID, string StudentName, int Course, int Age,
            double PrelimGrade, double MidtermGrade, double FinalTermGrade )
        {
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine($"Student ID: {StudentID}\n" +
                $"Student Name: {StudentName}\n" +
                $"Course: {Course}\n" +
                $"Age: {Age}");
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine($"Prelim Grade: {PrelimGrade}\n" +
                $"Midterm Grade: {MidtermGrade}\n" +
                $"Final Term Grade: {FinalTermGrade}\n");
        }
        public static void ComputeGrade(double PrelimGrade, double MidtermGrade, double FinalTermGrade)
        {
            double average = (PrelimGrade + MidtermGrade + FinalTermGrade) / 3;
            if (average >= 60)
                Console.ForegroundColor = ConsoleColor.Blue;
            else
                Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine($"Average: {average}");
            Console.ForegroundColor = ConsoleColor.Green;
        }
        static void Main(string[] args)
        {
            StudeInfo("00-00-01", "FERNAN W. AMMAQUI", 2, 20, 90.0, 90.0, 90.0);
            ComputeGrade(90.0, 90.0, 90.0);
            StudeInfo("00-00-02", "FERNAN W. EDGEN", 2, 21, 59.0, 59.0, 59.0);
            ComputeGrade(59.0, 59.0, 59.0);
        }
    }
}

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
New on Blog
APPROVED BY CLIENTS