Question: This is in C# In the previous project, you created a program to help instructors calculate student grades. You will modify the program to use

This is in C#

In the previous project, you created a program to help instructors calculate student grades. You will modify the program to use dictionaries and lists instead of multidimensional arrays for this assignment.

The key of the dictionary is an integer that is the student id. The value type in the dictionary is a list of type integers. Use this to store the scores for each student.

First, prompt the user to enter the number of students.

Second, prompt the user to enter the number of scores.

Use the two values so you know how many times to perform loops for prompting the user for additional data. (Hint: Think about what type of loop is best when you know how many times it should be executed.)

After you have prompted the user for the number of students and scores, then you will use a loop to prompt the user to enter the number of scores specified for each student found in the first prompt. This means if the user entered 2 for the first prompt and 10 for the second prompt, the program would prompt the instructor a total of 20 times. Make sure you label the student number and scores number in your prompt.

The first prompt might read "Enter Student 1 Score for scores 1,"while the second prompt would be

"Enter Student 1 Score for scores 2," and so on.

The student number (i.e., 1, 2, 3, etc.) is the key in the dictionary, and you add scores scores to the list of integers that stores the score for each student (i.e., this will be the value in the dictionary).

Output the student number, final grade, and corresponding letter grade. You may calculate the final grade however you see fit (you may use a loop, or you may use advanced C# features like the average function contained on collections).

What I have so far is this:

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;

namespace Lesson9 { class Program { static void Main(string[] args) { int noStudents, scores;

Console.Write(" How many students will be scored: "); noStudents = Convert.ToInt32(Console.ReadLine());

Console.Write(" Enter number of scores: "); scores = Convert.ToInt32(Console.ReadLine()); //int size = Convert.ToInt32(Console.ReadLine()); int sum = 0; string letterGrade; int grade;

int[,] studentScores = new int[noStudents, scores];

Console.WriteLine();

for (int i = 0; i < noStudents; i++) { for (int j = 0; j < scores; j++) {

Console.Write(" Enter Student: " + "'" +(i + 1) + "'" + " Score " + "'" + (j + 1) + "'" + ": "); studentScores[i, j] = Convert.ToInt32(Console.ReadLine()); }

Console.WriteLine(); } for (int j = 0; j < scores; j++) { sum = sum / scores; } grade = sum / scores; if (scores > 1 && scores <= 3) { letterGrade = "A"; } else if (scores > 4 && scores <= 5) { letterGrade = "B"; } else if (scores > 70 && scores <= 79) { letterGrade = "C"; } else if (scores > 60 && scores <= 69) { letterGrade = "D"; } else if (scores > 0 && scores <= 59) { letterGrade = "F"; } else { letterGrade = "zzzz"; } Console.WriteLine(" Student scores are: "); Console.WriteLine(" Student \t Scores "); for (int i = 0; i < noStudents; i++) { Console.Write(" " + (i + 1) + letterGrade);

for (int j = 0; j < scores; j++) { Console.Write("\t " + studentScores[i, j] + " " + letterGrade); } }

Console.ReadLine();

} } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!