TeacherTool
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
namespace TeacherTool
{
public class Program
{
public static void Main()
{
int counter = 1;
Console.WriteLine("Enter Number of students");
int numOfStu = int.Parse(Console.ReadLine());
Console.WriteLine("-------------------");
string[] name = new string[numOfStu];
int[] score = new int[numOfStu];
int total = 0;
int average, highest;
string ave, high;
for (int i = 0; i < numOfStu; i++)
{
Console.WriteLine("Enter Student{0} Name", counter);
name[i] = Console.ReadLine();
Console.WriteLine("Enter {0} score", name[i]);
score[i] = int.Parse(Console.ReadLine());
total += score[i];
Console.WriteLine("-------------------");
counter++;
}
average = total / numOfStu;
Array.Sort(score);
highest = score[score.Length - 1];
Console.WriteLine("{0} {1}", average, highest);
if (average >= 880)
ave = "A+";
else if (average >= 770 && average <= 879)
ave = "A";
else if (average >= 660 && average <= 769)
ave = "B";
else if (average >= 550 && average <= 649)
ave = "C";
else if (average >= 440 && average <= 549)
ave = "D";
else
ave = "E";
if (highest >= 880)
high = "A+";
else if (highest >= 770 && highest <= 879)
high = "A";
else if (highest >= 660 && highest <= 769)
high = "B";
else if (highest >= 550 && highest <= 649)
high = "C";
else if (highest >= 440 && highest <= 549)
high = "D";
else
high = "E";
Console.WriteLine("Average Grade {0} higest grade {1}", ave, high);
}
}
}
Comments
Post a Comment