-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
58 lines (49 loc) · 1.97 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace CodeLouisville.OOPExamples.ReportCards
{
class Program
{
static void Main(string[] args)
{
var reportCards = Program.GetAllReportCards();
//polymorphism and inheritanse allows us to
//to write this one piece of logic
//that behaves differently
foreach (var rptCard in reportCards)
{
Console.WriteLine(rptCard.TitleCard);
Console.WriteLine(rptCard.ToString());
Console.WriteLine();
}
Console.WriteLine("enter to close");
Console.ReadLine();
}
///
static IList<UnsignedReportCard> GetAllReportCards()
{
List<UnsignedReportCard> reportCards = new List<UnsignedReportCard>();
//we gave this report card to the student to take home
var rptCard =new UnsignedReportCard(){
ClassName = "History"
,Instructor = "Dr. Jones"
,Grade = 3.4M
,FirstName = "Peter"
,LastName = "Parker"};
//after parent returned the report card
var signedRptCard = new SignedReportCard(rptCard);
signedRptCard.DateSigned = new DateTime(2018,7,5);
signedRptCard.ParentName = "Uncle Ben";
//we are now sending this report card to the university
var submittedRptCard = new SubmittedReportCard(signedRptCard);
submittedRptCard.UniversityName = "American University";
submittedRptCard.DateSubmitted = new DateTime(2018,10,16);
reportCards.Add(rptCard);
reportCards.Add(signedRptCard);
reportCards.Add(submittedRptCard);
return reportCards;
}
}
}