-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathavia.java
More file actions
208 lines (164 loc) · 6.02 KB
/
avia.java
File metadata and controls
208 lines (164 loc) · 6.02 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
import java.io.PrintStream;
import java.util.Scanner;
class avia {
public static Scanner in = new Scanner(System.in);
public static PrintStream out =System.out;
private static int countOfObjects=0;
public String country; // - Страна происхождения
public String name; // - Название
public String model; // - Модель
public String length; // - Длинна
public String weight; // - Вес
public String material; // - Осносвной материал фюзеляжа
public String power;// - Мощность двигателя
public static int getCountOfObjects() {
return countOfObjects;
}
public static void setCountOfObjects(int countOfObjects) {
avia.countOfObjects = countOfObjects;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getLength() {
return length;
}
public void setLength(String length) {
this.length = length;
}
public String getWeight() {
return weight;
}
public void setWeight(String weight) {
this.weight = weight;
}
public String getMaterial() {
return material;
}
public void setMaterial(String material) {
this.material = material;
}
public String getPower() {
return power;
}
public void setPower(String power) {
this.power = power;
}
public String getAllInfo(){
return country+"; "+name+"; "+model+"; "+length+"; "+weight+"; "+material+"; "+power;
}
public avia(String country, String name, String model, String length, String weight, String material, String power){
this.country = country;
this.name = name;
this.model = model;
this.length = length;
this.weight = weight;
this.material=material;
this.power = power;
countOfObjects++;
}
// static int getCountOfObjects() {
// return countOfObjects;
// }
public static void main(String[] args){
sport sport1 = new sport("Italia","Macchi","M39","8m","1257kg","metal","597 kVt",1);
sport sport2=new sport("Germany","Extra","EA-300","7m","682kg","metal","224kVt",1);
sport sport3 = new sport("USA","Gee Bee","R-1 Super Sport","5,4m","1400kg","metal","1491kVt",1);
passenger passenger1 = new passenger("France","Airbus","A380","73m","280 000 kg","metal","8000kVt",4,525);
passenger passenger2=new passenger("USA","Boeing","787 Dreamliner","60m","120 000 kg","metal","320кН",2,300);
passenger passenger3 = new passenger("USA","Piper","PA-34 Seneca","9m","1457kg","metal","162кВт",2,6);
battle battle1 = new battle("USA","McDonnell","XF-85 Goblin","4,5m","1807kg","metal","13,3 kN","bomber","M2 Machine Gun");
battle battle2=new battle ("USA","Northrop","B-2 Spirit","21m","71 700kg","metal","76кН","bomber","nuclear bombs");
battle battle3 = new battle ("USA","Fairchild Republic","A-10 Thunderbolt II","16m","9176kg","metal","40kN","attack aircraft","Air-to-air missile");
out.println(sport1.getAllInfo());
out.println(sport2.getAllInfo());
out.println(sport3.getAllInfo());
out.println(passenger1.getAllInfo());
out.println(passenger2.getAllInfo());
out.println(passenger3.getAllInfo());
out.println(battle1.getAllInfo());
out.println(battle2.getAllInfo());
out.println(battle3.getAllInfo());
out.println("Number of created planes: "+countOfObjects);
}
}
class sport extends avia{
public int pilots; // количество пилотов
public sport(String country, String name, String model, String length, String weight, String material, String power,int pilots) {
super(country, name, model, length, weight, material, power);
this.pilots=pilots;
}
public int getPilots() {
return pilots;
}
public void setPilots(int pilots) {
this.pilots = pilots;
}
@Override
public String getAllInfo(){
return country+"; "+name+"; "+model+"; "+length+"; "+weight+"; "+material+"; "+power+"; "+pilots;
}
}
class passenger extends avia{
public int engines, people;
public int getEngines() {
return engines;
}
public void setEngines(int engines) {
this.engines = engines;
}
public int getPeople() {
return people;
}
public void setPeople(int people) {
this.people = people;
}
public passenger(String country, String name, String model, String length, String weight, String material, String power, int engines, int people) {
super(country, name, model, length, weight, material, power);
this.people=people;
this.engines=engines;
}
@Override
public String getAllInfo(){
return country+"; "+name+"; "+model+"; "+length+"; "+weight+"; "+material+"; "+power+"; "+engines+"; "+people;
}
}
class battle extends avia{
public String type,weapon;
public battle(String country, String name, String model, String length, String weight, String material, String power, String type, String weapon) {
super(country, name, model, length, weight, material, power);
this.type=type;
this.weapon=weapon;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getWeapon() {
return weapon;
}
public void setWeapon(String weapon) {
this.weapon = weapon;
}
@Override
public String getAllInfo(){
return country+"; "+name+"; "+model+"; "+length+"; "+weight+"; "+material+"; "+power+"; "+type+"; "+weapon;
}
}