-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
62 lines (51 loc) · 1.69 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
59
60
61
62
using System;
using System.Collections.Generic;
namespace Garage
{
class Program
{
static void Main(string[] args)
{
Zero fxs = new Zero();
Zero fx = new Zero();
Tesla modelS = new Tesla();
List<IElectricVehicle> electricVehicles = new List<IElectricVehicle>() {
fx, fxs, modelS
};
Console.WriteLine("Electric Vehicles");
foreach (IElectricVehicle ev in electricVehicles)
{
Console.WriteLine($"{ev.CurrentChargePercentage}");
}
foreach (IElectricVehicle ev in electricVehicles)
{
// This should charge the vehicle to 100%
ev.ChargeBattery();
}
foreach (IElectricVehicle ev in electricVehicles)
{
Console.WriteLine($"{ev.CurrentChargePercentage}");
}
/***********************************************/
Ram ram = new Ram();
Cessna cessna150 = new Cessna();
List<IGasVehicle> gasVehicles = new List<IGasVehicle>() {
ram, cessna150
};
Console.WriteLine("Gas Vehicles");
foreach (IGasVehicle gv in gasVehicles)
{
Console.WriteLine($"{gv.CurrentTankPercentage}");
}
foreach (IGasVehicle gv in gasVehicles)
{
// This should completely refuel the gas tank
gv.RefuelTank();
}
foreach (IGasVehicle gv in gasVehicles)
{
Console.WriteLine($"{gv.CurrentTankPercentage}");
}
}
}
}