Question

In: Computer Science

Using Visual Studio in C#; create a grading application for a class of ten students. The...

Using Visual Studio in C#; create a grading application for a class of ten students. The application should request the names of the students in the class. Students take three exams worth 100 points each in the class. The application should receive the grades for each student and calculate the student’s average exam grade. According to the average, the application should display the student’s name and the letter grade for the class using the grading scheme below. Grading Scheme: • A = 90-100 • B = 80-89 • C = 70-79 • D = 60-69 • F = <60

Solutions

Expert Solution

Create a C# console application with the name GradingApplication, add the below code in Program.cs

Program.cs

using System;

namespace GradingApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            //variable declarations
            string[] stuNames = new string[10];
            double[,] stuGrades = new double[10, 3];
            double[] stuAverage = new double[10];
            double grade, sum, avg;
            //run a loop that reads names and grade points of 10 students
            for(int i = 0; i < stuNames.Length;i++)
            {
                //prompt and read student name
                Console.Write("Enter the of student#" + (i + 1) + ": ");
                stuNames[i] = Console.ReadLine();
                //set sum to 0
                sum = 0;
                //run a loop to read grade points of three exams
                for(int j = 0; j < 3;j++)
                {
                    //prompt and read grade points received for each exam
                    Console.Write("Enter grade points received for exam #" + (j + 1) + ": ");
                    grade = Convert.ToDouble(Console.ReadLine());
                    //check if grade point entered is between 0 and 100
                    while (grade < 0 || grade > 100)
                    {
                        //if not within range display error message
                        Console.WriteLine("Error: Grade points must be between 0 and 100");
                        //reprompt for grade points received
                        Console.Write("Enter grade points received for exam #" + (j + 1) + ": ");
                        grade = Convert.ToDouble(Console.ReadLine());
                    }
                    stuGrades[i, j] = grade;
                    //add the grade to sum
                    sum = sum + grade;
                }
                avg = sum / 3.0;
                stuAverage[i] = avg;
            }
            Console.WriteLine();
            Console.WriteLine("Student Name\t\tLetter Grade Received");
            //run a loop to get average of each student and determine the letter grade received
            for(int i = 0; i < stuAverage.Length; i++)
            {
                //display the student name
                Console.Write(stuNames[i]+"\t\t\t");
                //display A if average is between 100 and 90
                if (stuAverage[i] >= 90 && stuAverage[i] <= 100)
                    Console.WriteLine("A");
                //display B if average is between 80 and 89
                else if (stuAverage[i] >= 80 && stuAverage[i] <= 89)
                    Console.WriteLine("B");
                //display C if average is between 70 and 79
                else if (stuAverage[i] >= 70 && stuAverage[i] <= 79)
                    Console.WriteLine("C");
                //display D if average is between 60 and 69
                else if (stuAverage[i] >= 60 && stuAverage[i] <= 69)
                    Console.WriteLine("D");
                //else display F
                else
                    Console.WriteLine("F");
            }
            Console.WriteLine("\nPress any key to continue...");
            Console.ReadKey();
        }
    }
}

Output:

Program Screenshot:


Related Solutions

Visual Studio C# Create an application illustrating the following: Class definition Encapsulation Constructor Instantiation Inheritance Suggestions:...
Visual Studio C# Create an application illustrating the following: Class definition Encapsulation Constructor Instantiation Inheritance Suggestions: Simulation Calculation Interface apps
ONLY USE VISUAL STUDIO (NO JAVA CODING) VISUAL STUDIO -> C# -> CONSOLE APPLICATION In this...
ONLY USE VISUAL STUDIO (NO JAVA CODING) VISUAL STUDIO -> C# -> CONSOLE APPLICATION In this part of the assignment, you are required to create a C# Console Application project. The project name should be A3<FirstName><LastName>P2. For example, a student with first name John and Last name Smith would name the project A1JohnSmithP2. Write a C# (console) program to calculate the number of shipping labels that can be printed on a sheet of paper. This program will use a menu...
create a C++ program using Visual Studio that could be used by a college to track...
create a C++ program using Visual Studio that could be used by a college to track its courses. In this program, create a CollegeCourse class includes fields representing department, course number, credit hours, and tuition. Create a child (sub class) class named LabCourse, that inherits all fields from the the CollegeCourse class, includes one more field that holds a lab fee charged in addition to the tuition. Create appropriate functions for these classes, and write a main() function that instantiates...
Create an ASP.Net Website using Visual Studio with C#: Create a simple calculator that has 3...
Create an ASP.Net Website using Visual Studio with C#: Create a simple calculator that has 3 text boxes: 2 of them to enter numbers, the 3rd one displays the results Create 4 buttons to add, subtract, multiply, and divide Prevent the user from entering text in the number fields Display a message indicating “cannot divide by” when the user click “/” and there is a zero the in the second box Create two additional buttons: - One to store data...
Create an ASP.Net Website using Visual Studio with Visual Basic.Net: Create a simple calculator that has...
Create an ASP.Net Website using Visual Studio with Visual Basic.Net: Create a simple calculator that has 3 text boxes: 2 of them to enter numbers, the 3rd one displays the results Create 4 buttons to add, subtract, multiply, and divide Prevent the user from entering text in the number fields Display a message indicating “cannot divide by” when the user click “/” and there is a zero the in the second box Create two additional buttons: - One to store...
C++ PROGRAM Using the attached C++ code (Visual Studio project), 1) implement a CoffeeMakerFactory class that...
C++ PROGRAM Using the attached C++ code (Visual Studio project), 1) implement a CoffeeMakerFactory class that prompts the user to select a type of coffee she likes and 2) returns the object of what she selected to the console. #include "stdafx.h" #include <iostream> using namespace std; // Product from which the concrete products will inherit from class Coffee { protected:    char _type[15]; public:    Coffee()    {    }    char *getType()    {        return _type;   ...
Must be in Visual C# using windows forms : Create an application that opens a specified...
Must be in Visual C# using windows forms : Create an application that opens a specified text file and then displays a list of all the unique words found in the file. Hint: Use a LINQ method to remove all duplicate words.
USE VISUAL STUDIO/VB In this assignment, you will create an array of ten elements, one for...
USE VISUAL STUDIO/VB In this assignment, you will create an array of ten elements, one for name, one for hours worked,and the last for hourly rate. The arrays will receive the information from inputs from the screen.For example, you will ask the following three questions: a) Employee name: b) Hours worked: c) Hourly rate: After you have received all ten records and have inserted them into the array, you will then calculate the hourly rate times the hours worked to...
Programming Language: C# CheckingAccount class You will implement the CheckingAccount Class in Visual Studio. This is...
Programming Language: C# CheckingAccount class You will implement the CheckingAccount Class in Visual Studio. This is a sub class is derived from the Account class and implements the ITransaction interface. There are two class variables i.e. variables that are shared but all the objects of this class. A short description of the class members is given below: CheckingAccount Class Fields $- COST_PER_TRANSACTION = 0.05 : double $- INTEREST_RATE = 0.005 : double - hasOverdraft: bool Methods + «Constructor» CheckingAccount(balance =...
In visual Studio C++ Create a program that uses a for loop to input the high...
In visual Studio C++ Create a program that uses a for loop to input the high temperature, and low temperature for each day of the week. The high and low will be placed into two elements of the array. For each loop the high and low will be placed into the next set of elements of the array. After the temps for all seven days have been entered into the array, a for loop will be used to pull out...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT