-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuestion3(b).java
More file actions
130 lines (86 loc) · 3.07 KB
/
Copy pathQuestion3(b).java
File metadata and controls
130 lines (86 loc) · 3.07 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import java.util.Scanner;
class Car {
private String car_tyres;
private String car_body;
private Engine engine;
private String car_brand;
private String car_type;
private String car_color;
public Car(String car_brand, String car_type, String car_color, String car_tyres, String car_body) {
this.car_tyres = car_tyres;
this.car_body = car_body;
this.engine = engine;
this.car_brand = car_brand;
this.car_type = car_type;
this.car_color = car_color;
}
public void getTrimLevel() {}
public String getCar_type() {
return car_type;
}
public void setCar_type(String car_type) {
this.car_type = car_type;
}
public String getCar_brand() {
return car_brand;
}
public void setCar_brand(String car_brand) {
this.car_brand = car_brand;
}
public String getCar_color() {
return car_color;
}
public void setCar_color(String car_color) {
this.car_color = car_color;
}
public String getCar_tyres() {
return car_tyres;
}
public void setCar_tyres(String car_tyres) {
this.car_tyres = car_tyres;
}
public String getCar_body() {
return car_body;
}
public void setCar_body(String car_body) {
this.car_body = car_body;
}
@Override
public String toString() {
return "Car{" + "car_brand=" + car_brand + ", car_type=" + car_type + ", car_color=" + car_color + ", car_tyres=" + car_tyres + ", car_body=" + car_body + '}';
}
}
class BaseCar extends Car {
public BaseCar(String car_brand, String car_type, String car_color, String car_tyres, String car_body, Engine engine) {
super(car_brand, car_type, car_color, car_tyres, car_body );
}
}
class LuxuryCar extends Car {
public LuxuryCar(String car_brand, String car_type, String car_color, String car_tyres, String car_body, Engine engine) {
super(car_brand, car_type, car_color, car_tyres, car_body);
}
}
class SportCar extends Car {
public SportCar(String car_brand, String car_type, String car_color, String car_tyres, String car_body, Engine engine) {
super(car_brand, car_type, car_color, car_tyres, car_body);
}
}
interface Engine {
}
interface ElectricEngine extends Engine{
}
interface PetrolEngine extends Engine {
}
class HybridEngine implements PetrolEngine , ElectricEngine{
}
class Test {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
Car car = new Car("suzuki", "hhh", "green" , "service", "metalic" );
System.out.println("Car Details");
System.out.println(car.toString());
System.out.println("Engine Details");
System.out.println("\nEnter Engine Type");
String type = scanner.next();
}
}