Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

USE C# SLOVE THE PROJECT Program Overview This program stores a list of 5 names and corresponding scores and is able to look up scores

USE C# SLOVE THE PROJECT

image text in transcribed

image text in transcribed

Program Overview This program stores a list of 5 names and corresponding scores and is able to look up scores by name. It will utilize two parallel arrays to store the names and integers but keep the order of the names and scores synchronized i.e. if Johns name is in index 1, then Johns score should also be in index 1 in a different array.

Instructions Name your class file: StudentSystem.cs

1. Declare the following static variables: One array of type integer and named scoreArray One array of type string and named nameArray Declare and implement the following static methods:

2. Method Name: PopulateNameArray Purpose: Prompt the user and read student names and store them into an array of strings.

Parameters: none Return Type: None General method logic: Your method should prompt the user to enter names and it should store names into the names array, which is declared as a static variable in the class. You do not know beforehand how many names you need to ask for. Determine that using the length of the array.

3. Method Name: PopulateScoreArray Purpose: To prompt the user and read 5 student scores and store them into an array of strings. This method will prompt the user to enter a score by name. e.g. Enter Johns score: Parameters: None Return Type: None General method logic: You should loop through all the elements of the arrays (both arrays have the same number of elements). For each name in the names array, ask the user for a score. Store the score in the scores array. Use the same index number for both arrays, e.g. if Michael is at index 2 in names, Michaels score is located at index 2 in scores. These are parallel arrays!

4. Method Name: FindStudentPosition Purpose: This method accepts the name of a student and returns the location of that student in the names array. Parameters: one string, called nameOfStudent Return Type: Integer General method logic: This method should loop through the nameArray and search for the element that contains the nameOfStudent that has been provided to it as a parameter. Once it finds a match, it should return the location of that student in the array. This means that if the student name is found at index 5, it returns 5. If the student name is not found in the entire array, it returns -1. This method is NOT returning either a student name or a student score, but rather only his or her location in the array. It should NOT write ANYTHING to the Console. Performance consideration: If you have an array sized 1000, and you found the student you were looking for in index 5, would you want continue looking through locations 6 to 999?

5. Method Name: Main Purpose: The Main method is where the program will actually execute. This method will initialize the arrays storing student names and scores and it will call the other three methods that you wrote in the correct sequence. Detailed Method Logic: a) Allocate nameArray and scoreArray with 5 elements each. b) Print a welcome message to the console window and then call the PopulateNameArray and PopulateScoreArray methods. Pass any arguments, if needed. c) Clear the console screen by calling the Clear() method of the Console class. Look up if the method is static or non-static! d) Prompt the user to enter a name for whom to look up a score. It should store that in a local variable (you will need to declare one!) e) Call FindStudentPosition method. Pass to it any arguments that the method specifies as parameters. Store the return value of the FindStudentPosition method in a variable called studentPosition. f) If the return value stored in studentPosition is -1, it should tell the user that a student by that name does not exist in the database. g) Otherwise, it should look up the score using scoreArray at the appropriate index (studentPosition) and print out the score along with the name of the student to the console.

file//G:/CIS 340 Fail 2016/Assignments/A5/Assignment2/bir/Debug/Assignment2 EXE This progran will store student grades and look then up for o Enter the names of 5 students Student Grade System Mike Susan Peter Emily Jake Enter scores. One score p line Enter score for Mike: 89 Enter score for Susan: 78 Enter score for Peter: 78 Enter score for Enily: 98 Enter score for Jake: 83

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions