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
| class Car {
int maxSpeed;
num price;
String name;
Car(int maxSpeed, num price, String name) {
this.maxSpeed = maxSpeed;
this.price = price;
this.name = name;
}
num saleCar() {
this.price *= 0.9;
return this.price;
}
}
void main() {
Car bmw = new Car(320, 100000, 'BMW');
Car benz = new Car(250, 70000, 'BENZ');
Car ford = new Car(200, 80000, 'FORD');
bmw.saleCar();
bmw.saleCar();
bmw.saleCar();
print(bmw.price);
}
|