Добавил:
nyan
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Александр Б. / Основы Java / lab2_java / src / lab2_java / Truck
.java package lab2_java;
import java.util.Random;
public class Truck extends Car {
private int weight;
private int height;
Truck(){
super();
weight = 10;
height = 3;
}
Truck(String model, int speed, Radio radio, int weight, int height){
super(model, speed, radio);
this.weight = weight;
this.height = height;
}
int getWeight(){
return this.weight;
}
int getHeight() {
return this.height;
}
void RandomTr(){
this.Random();
Random random = new Random();
this.weight = random.nextInt(100);
this.height = random.nextInt(10);
}
String toStr_Truck() {
return "\nВес: " + this.weight + " Высота: " + this.height + this.toStr_Car();
}
}
import java.util.Random;
public class Truck extends Car {
private int weight;
private int height;
Truck(){
super();
weight = 10;
height = 3;
}
Truck(String model, int speed, Radio radio, int weight, int height){
super(model, speed, radio);
this.weight = weight;
this.height = height;
}
int getWeight(){
return this.weight;
}
int getHeight() {
return this.height;
}
void RandomTr(){
this.Random();
Random random = new Random();
this.weight = random.nextInt(100);
this.height = random.nextInt(10);
}
String toStr_Truck() {
return "\nВес: " + this.weight + " Высота: " + this.height + this.toStr_Car();
}
}