You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
947 B
47 lines
947 B
public class Car {
|
|
private String brand;
|
|
private String color;
|
|
private double price;
|
|
|
|
public Car() {
|
|
this.brand = "未知";
|
|
this.color = "白色";
|
|
this.price = 100000;
|
|
}
|
|
|
|
public Car(String brand, String color, double price) {
|
|
this.brand = brand;
|
|
this.color = color;
|
|
if (price > 0) {
|
|
this.price = price;
|
|
} else {
|
|
this.price = 100000;
|
|
}
|
|
}
|
|
|
|
public String getBrand() {
|
|
return brand;
|
|
}
|
|
|
|
public void setBrand(String brand) {
|
|
this.brand = brand;
|
|
}
|
|
|
|
public String getColor() {
|
|
return color;
|
|
}
|
|
|
|
public void setColor(String color) {
|
|
this.color = color;
|
|
}
|
|
|
|
public double getPrice() {
|
|
return price;
|
|
}
|
|
|
|
public void setPrice(double price) {
|
|
if (price > 0) {
|
|
this.price = price;
|
|
}
|
|
}
|
|
}
|