Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Gradebook/Gradebook.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

</Project>
63 changes: 63 additions & 0 deletions Gradebook/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using System;
using System.Linq;
using System.Collections.Generic;
namespace Grades.cs
{
class Program
{
static void Main(string[] args)
{
Dictionary<string, List<int>> 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<string, List<int>> getStudent()
{
Dictionary<string, List<int>> grades = new Dictionary<string, List<int>>();
//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<int> getStudentGrade()
{

List<int> gradebook = new List<int>();
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;
}
}
}