-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCar.cs
79 lines (66 loc) · 2.38 KB
/
Car.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GitIntegrationDemo
{
class Car
{
public string Make;
public string Model;
public double InitialCost;
public double TotalPaid;
public int TopSpeed;
public bool Convertible;
public string Country;
public int Mileage;
public int YearBought;
public int CurrentYear;
public string GetWarrantyData()
{
return "This is allot of warranty data...";
}
public Boolean PaidInFull()
{
return (InitialCost - TotalPaid == 0);
}
public void PrintCarData(Car mycar)
{
var msg = new StringBuilder();
msg.AppendLine("Make: " + mycar.Make);
msg.AppendLine("Model: " + mycar.Model);
msg.AppendLine("Initial Cost: " + mycar.InitialCost);
msg.AppendLine("Total Paid: " + mycar.TotalPaid);
msg.AppendLine("Top Speed: " + mycar.TopSpeed);
msg.AppendLine("Convertible: " + mycar.Convertible);
msg.AppendLine("Warranty Data: " + mycar.GetWarrantyData());
msg.AppendLine("Is the car paid in full? " + (mycar.PaidInFull() ? "Yes" : "No"));
Console.WriteLine(msg);
}
public void PrintCarData()
{
var msg = new StringBuilder();
msg.AppendLine("\nMake2: " + Make);
msg.AppendLine("Model2: " + Model);
msg.AppendLine("Initial Cost2: " + InitialCost);
msg.AppendLine("Total Paid2: " + TotalPaid);
msg.AppendLine("Top Speed2: " + TopSpeed);
msg.AppendLine("Convertible2: " + Convertible);
msg.AppendLine("Warranty Data2: " + GetWarrantyData());
msg.AppendLine("Is the car paid in full2? " + (PaidInFull() ? "Yes" : "No"));
msg.AppendLine("Country: " + Country);
msg.AppendLine("Mileage: " + Mileage);
msg.AppendLine("Years of Onwership: " + YearsOfOwnership());
Console.WriteLine(msg);
}
public void IsCarPaid()
{
Console.WriteLine(string.Format("My car is {0}paid", (PaidInFull() ? "" : "Not ")));
}
public int YearsOfOwnership()
{
return (CurrentYear - YearBought);
}
}
}