-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCar.cs
51 lines (46 loc) · 2.03 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
using System;
using System.Collections.Generic;
namespace Ex03.GarageLogic
{
public class Car : Vehicle
{
eVehicleColor m_VehicleColor;
eDoorsNumber m_DoorsNumber;
public Car(string i_ModelName, string i_RegNumber, float i_precentageLeft, List<Wheel> i_WheelsCollection, Engine i_Engine,
eVehicleColor i_VehicleColor, eDoorsNumber i_DoorsNumber):
base( i_ModelName, i_RegNumber, i_precentageLeft, i_WheelsCollection, i_Engine)
{
m_VehicleColor = i_VehicleColor;
m_DoorsNumber = i_DoorsNumber;
}
public override string ToString()
{
string s = base.GetEngine.ToString();
string s2 = Environment.NewLine + "Wheels :" + Environment.NewLine;
int Wheelscount = 1;
foreach (var Wheel in base.Wheels) // a string for wheels info
{
s2 += "wheel number : " + Wheelscount + Environment.NewLine + Wheel.ToString() + Environment.NewLine; ;
Wheelscount++;
}
string ouput = string.Format("Car Details : " + Environment.NewLine + "Model Name : {0}" +
Environment.NewLine +
"Reg number : {1}" + Environment.NewLine + "Percentage Of Engine Left {2}" +
Environment.NewLine + s +
"Color : {3}" + Environment.NewLine + "Number of doors: {4}" +
Environment.NewLine+s2,
base.ModelName, base.RegNumber, base.PercentageOfEngLeft, m_VehicleColor, m_DoorsNumber);
return ouput;
}
public eVehicleColor Color
{
get { return m_VehicleColor; }
set { m_VehicleColor = value; }
}
public eDoorsNumber DoorsNumber
{
get { return m_DoorsNumber; }
set { m_DoorsNumber = value; }
}
}
}