Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace StudentTestScoreArray
- {
- class Program
- {
- static void Main(string[] args)
- {
- string numberStudents;
- string tempValue;
- int numStudents = 0;
- int numTest = 0;
- int testScore = 0;
- int[] highScore;
- int[] lowScore;
- int[] scoreAverage;
- int[] studentID;
- StringBuilder finalString = new StringBuilder();
- Console.WriteLine("Enter in the number of students:");
- numberStudents = Console.ReadLine();
- numStudents = Convert.ToInt32(numberStudents);
- studentID = new int[numStudents];
- scoreAverage = new int[numStudents];
- highScore = new int[numStudents];
- lowScore = new int[numStudents];
- for (int i = 0; i < numStudents - 1; i++)
- {
- Console.WriteLine("Enter the student ID:");
- tempValue = Console.ReadLine();
- studentID[i] = Convert.ToInt32(tempValue);
- Console.WriteLine("Enter the number of test: ");
- tempValue = Console.ReadLine();
- numTest = Convert.ToInt32(tempValue);
- for (int j = 0; j < numTest -1; j++)
- {
- Console.WriteLine("Enter the test score:");
- tempValue = Console.ReadLine();
- testScore = Convert.ToInt32(tempValue) + testScore;
- if (j == 0)
- {
- highScore[i] = testScore;
- lowScore[i] = testScore;
- }
- else
- {
- if (highScore[i] < testScore)
- highScore[i] = testScore;
- if (lowScore[i] > testScore)
- lowScore[i] = testScore;
- }
- }
- scoreAverage[i] = testScore / numTest;
- }
- for (int i = 0; i < studentID.Length; i++)
- {
- finalString.Append("Student ID: ");
- finalString.Append(studentID[i]);
- finalString.AppendLine();
- finalString.Append("Average Test score:");
- finalString.Append(scoreAverage[i]);
- finalString.AppendLine();
- finalString.Append("Highest Score:");
- finalString.Append(highScore[i]);
- finalString.AppendLine();
- finalString.Append("Lowest Score:");
- finalString.Append(lowScore[i]);
- finalString.AppendLine;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement