Hello again everyone, working on another assignment for class. My professor teaches us the long way of writing code instead of making it simplified and shorter. Here is the actual assignment and what I have attempted so far. Any help and advice is most GREATLY APPRECIATED.
1. A two-dimensional array for storing the three quiz grades for a class of 5 students; this array must be initialized to the following:
{ { 87, 68, 94 }, { 100, 83, 78 }, { 85, 91, 76 }, { 65, 81, 66 }, { 65, 71, 56 } }
2. A one-dimensional array for storing the average quiz grade for each student.
Your application should perform the following tasks:
1. Calculate and store the average grade for each student.
2. Print to the console a nicely formatted two-dimensional table with headings listing the student number (0 to 4), the grade for each quiz (Quiz 1, ... Quiz 3), and the average.
3. Bonus: For 2 bonus points, also provide the data structures and processing for storing last names for the students and including these last names in the two-dimensional table printed out on the console
//Two-Dimensional Arrays.cs
//Student Quiz Grades
using System;
class StudentQuizGrades
{
static void Main(string[] args)
{
//array of student grades
int[,] average = new int[,] { { 87, 68, 94 }, { 100, 83, 78 }, { 85, 91, 76 }, { 65, 81, 66}, {65, 71, 56 }};
}
{
//output grades array
OutputGrades();
Console.WriteLine("\n{0} {1}\n{2} {3}\n", Average));
}
{
//Determine average grade per student
public double GetAverage(int student)
int amount = grades.GetLength(1);
int total = 0; //initialize total
//sum grades for one student
for (int exam = 0; exam < amount; exam++)
total += grades[ student, exam ];
//return average of grades
return (double) total / amount;
}
}