Finished Overload Methods; Finished Defining Properties

jason.zhu 2021-02-22 03:28:38 +00:00
parent 15bd8fcbb5
commit fc7844c6bc
2 changed files with 18 additions and 2 deletions

View File

@ -6,7 +6,22 @@ namespace GradeBook
public class Book
{
private List<double> grades;
public string Name;
private string name;
public string Name
{
get
{
return name;
}
set
{
if (!String.IsNullOrEmpty(value))
{
name = value;
}
}
}
public Book(string name)
{
@ -25,7 +40,7 @@ namespace GradeBook
}
}
public void AddLetterGrade(char letter)
public void AddGrade(char letter)
{
switch (letter)
{

View File

@ -30,6 +30,7 @@ namespace GradeBook
{
Console.WriteLine($"Received: {input}");
book.AddGrade(Convert.ToDouble(input));
// book.AddGrade('A');
}
catch (ArgumentException ex)
{