-
Notifications
You must be signed in to change notification settings - Fork 103
Expand file tree
/
Copy pathProgram.cs
More file actions
81 lines (79 loc) · 2.09 KB
/
Program.cs
File metadata and controls
81 lines (79 loc) · 2.09 KB
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
using System;
namespace week6_1
{
class Manufacture
{
public static void Main(string[] args)
{
Car bmw = new Car(2,"BMW");
Car audi = new Car(2,"Audi");
Truck ford = new Truck(4,"Ford");
Truck crysler = new Truck(4,"Crysler");
Console.WriteLine(string.Format("The manufacture is {1} and the car has {0} spots available for passengers.",bmw.spots, bmw.Type));
Console.WriteLine(string.Format("The manufacture is {1} and the car has {0} spots available for passengers.",audi.spots, audi.Type));
Console.WriteLine(string.Format("The manufacture is {1} and the truck has {0} spots available for passengers.",ford.Spots, ford.Type));
Console.WriteLine(string.Format("The manufacture is {1} and the truck has {0} spots available for passengers.",crysler.Spots,crysler.Type));
}
}
public interface IcheckCar
{
int getAvaiableSeat();
string getVehicle();
}
class Car : IcheckCar
{
public int Spots;
public string Type;
public Car(int spots,string type)
{
this.spots = spots;
this.Type = type;
}
public int spots
{
get;
set;
}
public string type
{
get;
set;
}
int IcheckCar.getAvaiableSeat()
{
return spots;
}
string IcheckCar.getVehicle()
{
return type;
}
}
class Truck : IcheckCar
{
public int Spots;
public string Type;
public Truck(int spots, string type)
{
this.Spots = spots;
this.Type = type;
}
public int spots
{
get;
set;
}
public string type
{
get;
set;
}
int IcheckCar.getAvaiableSeat()
{
return spots;
}
string IcheckCar.getVehicle()
{
return type;
}
}
}