-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweek5a.java
More file actions
46 lines (37 loc) · 851 Bytes
/
week5a.java
File metadata and controls
46 lines (37 loc) · 851 Bytes
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
public class week5a {
public static void main(String[] args) {
cost c = new cost("Sedan", "Audi", 40480000);
c.vehicleInfo();
c.brandInfo();
c.costInfo();
}
}
class vehicleType {
String vname;
vehicleType(String type) {
vname = type;
}
void vehicleInfo() {
System.out.println("Vehicle Name :" + vname);
}
}
class brandType extends vehicleType {
String bname;
brandType(String type, String brand) {
super(type);
bname = brand;
}
void brandInfo() {
System.out.println("Brand Info :" + bname);
}
}
class cost extends brandType {
int cost;
cost(String type, String brand, int cost) {
super(type, brand);
this.cost = cost;
}
void costInfo() {
System.out.println("cost :" + cost);
}
}