diff --git a/Gradebook/Gradebook.csproj b/Gradebook/Gradebook.csproj new file mode 100644 index 00000000..23df6047 --- /dev/null +++ b/Gradebook/Gradebook.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp2.1 + + + diff --git a/Gradebook/Program.cs b/Gradebook/Program.cs new file mode 100644 index 00000000..fe2b26b0 --- /dev/null +++ b/Gradebook/Program.cs @@ -0,0 +1,63 @@ +using System; +using System.Linq; +using System.Collections.Generic; +namespace Grades.cs +{ + class Program + { + static void Main(string[] args) + { + Dictionary> grades = getStudent(); + foreach(var key in grades.Keys) + { + Console.WriteLine("Students Name: " + key); + Console.WriteLine("The Average grade is " + grades [key].Average()); + Console.WriteLine("The Minimum grade is " + grades [key].Min()); + Console.WriteLine("The Max grade is " + grades [key].Max()); + } + + } + public static Dictionary> getStudent() + { + Dictionary> grades = new Dictionary>(); + //Prompt User to Add names of the Student they want to add. + Console.WriteLine("What is the Students name? "); + string name = Console.ReadLine(); + grades.Add(name, getStudentGrade()); + Console.WriteLine("Do you want to add another Student?"); + string keepAdding = Console.ReadLine().ToLower(); + while(keepAdding != "no") + { + Console.WriteLine("What is the students name?"); + string newAnswer = Console.ReadLine(); + grades.Add(newAnswer, getStudentGrade()); + Console.WriteLine("Do you want to add another Student?"); + keepAdding = Console.ReadLine(); + } + return grades; + } + public static List getStudentGrade() + { + + List gradebook = new List(); + Console.WriteLine("What is the Students grade?"); + int grade = Convert.ToInt32(Console.ReadLine()); + + gradebook.Add(grade); + Console.WriteLine("Do you want to add another grade?"); + + string x = Console.ReadLine().ToLower(); + while (x != "no") + { + Console.WriteLine("What is the grade"); + int numAnswer = Convert.ToInt32(Console.ReadLine()); + gradebook.Add(numAnswer); + Console.WriteLine("Add another"); + x = Console.ReadLine(); + + } + + return gradebook; + } + } +} \ No newline at end of file