-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAutoAss14.java
More file actions
144 lines (104 loc) · 3.43 KB
/
AutoAss14.java
File metadata and controls
144 lines (104 loc) · 3.43 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
package automob;
import java.util.Date;
class Automobile
{
Date make;
String type;
double maxSpeed,mileage;
long price,registrationNumber;
void setData(Date make,String type,double maxSpeed,double mileage,long price,long registrationNumber) //setValues
{
this.make=make;
this.type=type;
this.maxSpeed=maxSpeed;
this.mileage=mileage;
this.price=price;
this.registrationNumber=registrationNumber;
}
/*Automobile(Date make,String type,double maxSpeed,double mileage,long price,long registrationNumber) //constructor
{
this.make=make;
this.type=type;
this.maxSpeed=maxSpeed;
this.mileage=mileage;
this.price=price;
this.registrationNumber=registrationNumber;
}*/
void show1() //displayValues
{
System.out.println(" Manufacture Date "+make+" Automobile Type "+type+" MaxSpeed "+maxSpeed+" Mileage "+mileage+" Price "+price+" RegistrationNumber "+registrationNumber);
}
}
class Track extends Automobile
{
double capacity;
String hoodType;
int noOfWheels;
void setData(double capacity,String hoodTypes,int noOfWheels,Date make,String type,double maxSpeed,double mileage,long price,long registrationNumber)
{
super.setData(make, type, maxSpeed, mileage, price, registrationNumber);
this.capacity=capacity;
this.hoodType=hoodType;
this.noOfWheels=noOfWheels;
}
void show1()
{
super.show1();
System.out.println(" Capacity "+capacity+" hoodType "+hoodType+" noOfWheels "+noOfWheels);
}
/* Track(Date make,String type,double maxSpeed,double mileage,long price,long registrationNumber) //invoking value by constructor
{
super(make,type,maxSpeed,mileage,price,registrationNumber);
}
void show()
{
super.show1();
System.out.println(" Manufacture Date "+make+" Automobile Type "+type+" MaxSpeed "+maxSpeed+" Mileage "+mileage+" Price "+price+" RegistrationNumber "+registrationNumber);
}
Track(double capacity,String hoodType,int noOfWheels) //set value by constructor
{
this.capacity=capacity;
this.hoodType=hoodType;
this.noOfWheels=noOfWheels;
} */
}
class Car extends Automobile
{
int noOfDoors,seatingCapacity;
void setData(int noOfDoors,int seatingCapacity,Date make,String type,double maxSpeed,double mileage,long price,long registrationNumber)
{
super.setData(make, type, maxSpeed, mileage, price, registrationNumber);
this.noOfDoors=noOfDoors;
this.seatingCapacity=seatingCapacity;
}
void show1()
{
super.show1();
System.out.println(" Number Of doors "+noOfDoors+" Seating Capacity "+seatingCapacity);
}
/* Car(Date make,String type,double maxSpeed,double mileage,long price,long registrationNumber)
{
super(make,type,maxSpeed,mileage,price,registrationNumber)
}
void show()
{
super.show1();
System.out.println(" Manufacture Date "+make+" Automobile Type "+type+" MaxSpeed "+maxSpeed+" Mileage "+mileage+" Price "+price+" RegistrationNumber "+registrationNumber);
} */
}
public class AutoAss14
{
public static void main(String args[])
{
Automobile auto=new Automobile();
Date d1= new Date(2020,02,16);
auto.setData(d1,"ABC",40.00,50.00,60000L,12345L);
auto.show1();
Track tr=new Track();
tr.setData(25.00,"Yes",4,d1,"DEF",50.00,60.00,75000L,23456L);
tr.show1();
Car c=new Car();
c.setData(4,6,d1,"GHI",60.00,70.00,80000L,34567L);
c.show1();
}
}