/
DemoCompareObjects.cs
97 lines (75 loc) · 3.34 KB
/
DemoCompareObjects.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
using System;
namespace IllySystems
{
class DemoCompareObjects
{
public static void Main()
{
Console.WriteLine("Enter V to view demo C to create demo");
string result = Console.ReadLine();
if (result.ToLower().Equals("v"))
{
ViewDemo();
}
else if(result.ToLower().Equals("c"))
{
ObjectA person_A = new ObjectA();
ObjectB person_B = new ObjectB();
CreateDemo(person_A, person_B);
}
}
private static void ViewDemo()
{
ObjectA person_A = new ObjectA("A", 26, new DateTime(1990, 6, 10));
ObjectB person_B = new ObjectB("B", 10, new DateTime(2006, 7, 10));
person_B.objectBEmploymentHistory.Department = "IT";
person_B.objectBEmploymentHistory.startDate = new DateTime(2012, 02, 09);
person_B.objectBEmploymentHistory.HourWorked = 38.5;
person_A.objectAEmploymentHistory.Department = "HR";
person_A.objectAEmploymentHistory.startDate = new DateTime(2010, 05, 09);
person_A.objectAEmploymentHistory.HourWorked = 37.5;
new Auditor().CompareObjects(person_A, person_B);
}
public static void CreateDemo(ObjectA person_A, ObjectB person_B)
{
Console.WriteLine("Enter name of first object");
string name_A = Console.ReadLine();
Console.WriteLine("Enter security number of first object");
int age_A = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter date of birth of first object (mm/dd/yyyy)");
DateTime dateOfBirth_A = Convert.ToDateTime(Console.ReadLine());
person_A.Surname = name_A;
person_A.SecurityNumber = age_A;
person_A.DateOfBirth = dateOfBirth_A;
Console.WriteLine("Enter department of first object");
string dep_A = Console.ReadLine();
person_A.objectAEmploymentHistory.Department = dep_A;
Console.WriteLine("Enter start date of first object (mm/dd/yyyy)");
DateTime startDate_A = Convert.ToDateTime(Console.ReadLine());
person_A.objectAEmploymentHistory.startDate = startDate_A;
Console.WriteLine("Enter work hours of first object");
double workHours_A = Convert.ToDouble(Console.ReadLine());
person_A.objectAEmploymentHistory.HourWorked = workHours_A;
Console.WriteLine("Enter name of second object");
string name_B = Console.ReadLine();
Console.WriteLine("Enter security number of second object");
int age_B = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter date of birth of second object (mm/dd/yyyy)");
DateTime dateOfBirth_B = Convert.ToDateTime(Console.ReadLine());
person_B.Surname = name_B;
person_B.SecurityNumber = age_B;
person_B.DateOfBirth = dateOfBirth_B;
Console.WriteLine("Enter department of second object");
string dep_B = Console.ReadLine();
person_B.objectBEmploymentHistory.Department = dep_B;
Console.WriteLine("Enter start date of second object (mm/dd/yyyy)");
DateTime startDate_B = Convert.ToDateTime(Console.ReadLine());
person_B.objectBEmploymentHistory.startDate = startDate_B;
Console.WriteLine("Enter work hours of second object");
double workHours_B = Convert.ToDouble(Console.ReadLine());
person_B.objectBEmploymentHistory.HourWorked = workHours_B;
Console.ReadKey();
new Auditor().CompareObjects(person_A, person_B);
}
}
}