Finished Challenge: Taking User Input from Console; By myself
parent
8d917a0c57
commit
5ea0c1bd54
|
@ -8,15 +8,34 @@ namespace GradeBook
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
|
||||||
var book = new Book("Scott's Grade Book");
|
// var book = new Book("Scott's Grade Book");
|
||||||
book.AddGrade(89.1);
|
// book.AddGrade(89.1);
|
||||||
book.AddGrade(90.5);
|
// book.AddGrade(90.5);
|
||||||
book.AddGrade(87.2);
|
// book.AddGrade(87.2);
|
||||||
|
|
||||||
|
var book = new Book("Jason's Grade Book");
|
||||||
|
string input;
|
||||||
|
|
||||||
|
bool if_continue = true;
|
||||||
|
while (if_continue)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Give input: ");
|
||||||
|
input = Console.ReadLine();
|
||||||
|
if (input == "Q" || input == "q")
|
||||||
|
{
|
||||||
|
Console.WriteLine("Receiving termination signal; Termiate program");
|
||||||
|
break;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Received: {input}");
|
||||||
|
book.AddGrade(Convert.ToDouble(input));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var stats = book.GetStatistics();
|
var stats = book.GetStatistics();
|
||||||
|
|
||||||
Console.WriteLine($"The lowest grade is {stats.lowGrade}");
|
Console.WriteLine($"The lowest grade is {stats.lowGrade}");
|
||||||
Console.WriteLine($"The highest grade is {stats.highGrade}");
|
Console.WriteLine($"The highesst grade is {stats.highGrade}");
|
||||||
Console.WriteLine($"The average grade is {stats.Average:N1}");
|
Console.WriteLine($"The average grade is {stats.Average:N1}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue