Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You will write a C# program that will utilize arrays to store students names, ID numbers, and grades. Your program will also calculate average grades
You will write a C# program that will utilize arrays to store students names, ID numbers, and
grades. Your program will also calculate average grades for each student. Three one dimensional
arrays will be created in the main method to store the ID number integers name strings and
number of courses integer for each student. Another dimensional rectangular array double
type will be created to store students grades. Each row of this dimensional array will store the
grades for one student. In a row, each column will store the grade of a course for that student.
Additionally, an integer variable will keep track of the total number of students. The maximum
number of students and the maximum number of courses for each student will be and
respectively. The program will ask the user to input one of four options: R or r for registering a
student E or e for entering grade of a student C or c for calculating the average grade of a
student and Q or q to quit. Your program will use a loop to check for valid choices. The program
will continue taking inputs until the user enters Q or q
Based on the user input, in the Main method, you will use a switch statement to call the following
three methods as appropriate:
A public static void RegisterStudent int ids, string names, ref int nStudents:
This method will be called to enter a new students ID number and name in the arrays: ids
and names. First, this method will check if the total number of students is less than the
maximum allowed If yes, the students id and name will be taken as input and stored
in the arrays ids and names. The parameter nStudents will help you to keep track of the
current number of students and determine the array index to store the name and id of the
student. nStudents will be updated after successful registration of the student. Appropriate
messages should be shown for both successful and unsuccessful registration.
B public static void EnterGrade int ids, int nGrades, double grades:
This method will take an id from the user, search the id by simply using a loop in the ids
array, and find the index of the input id in the array. If the students id is found, the index
will be used to check the nGrades array to find out how many grades have been entered so
far for that particular student. If it is less than a new grade will be taken as input and be
entered into the grades array. The row number will be the index of the students id in the
ids array, and the column number will be determined by the value taken from the nGrades
array at that index. After successful entry, the value in the nGgrades array for that student
will be updated. Appropriate messages should be shown for student not found, no more
space for entering grades, and successful entry of the grade.
C public static void CalculateAverage int ids, int nGrades, string names, double
grades:
This method will take an id from the user, search the id by simply using a loop in the ids
array, and find the index of the input id in the array. If the students id is found, the index
will be used to check the nGrades array to find out how many grades have been entered so
far for that particular student. If there is at least one grade, the grades array will be accessed
to calculate the average. The calculated average will be printed along with the name and
the id of the student. Appropriate messages will be shown for student not found and no
grades in the record.
See below an example of the contents of the arrays after successful registration of students and
successful entries of some grades. The first, the second and the third student has so far and
grades, respectively.
ids names nGrades
grades
Jane
Joe
David
Important: You should use the method headers as given above. Do NOT use any C# languagefeatures or data input methods that has not been taught in the class. Check the lecture slides
to verify this. Some concepts may exist in the textbook, but we did not learn those in the class.
You are NOT allowed to use these. Submissions that utilize any C# languagefeatures beyond
the lecture slides will automatically receive in the assignment.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started