I am new to the site and also to programming. I am having problems with an assignment due on tomorrow and was hoping to get advice on what I may be doing wrong or missing. The assignment and code is included below:
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
CODE:
//Two-Dimensional Arrays.cs
//Student Quiz Grades
using System;
class StudentQuizGrades
{
static void Main(string[] args)
{
//array of student grades
decimal[,] Quizzes = { { 87, 68, 94 }, { 100, 83, 78 }, { 85, 91, 76 }, { 65, 81, 66 }, { 65, 71, 56 } };
Quizzes[4, 2];
//average quiz grade array
decimal[,] QuizAverage = {{}, {}, {}, {}, {}};
//student name array
string[] Name = new string {{James}, {Johnson}, {Smith}, {Michaels}, {Roberts}};
count NumQuiz = 3;
Decimal total = 0;
for (student = 0; student < QuizLength; student++)
{
for (quizCount = 0; quizCount < NumQuiz; quizCount++)
total = total + Quiz[student.quizCount];
Average[student] = total / NumQuiz;
}
}
}
Bookmarks