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.
62 lines
1.3 KiB
62 lines
1.3 KiB
package com.car.model;
|
|
|
|
/**
|
|
* 车轮类 - 汽车的基础组件
|
|
* 与Car类是组合关系
|
|
*/
|
|
public class Wheel {
|
|
private String size; // 尺寸
|
|
private String type; // 类型 (夏季/冬季/全季)
|
|
private int pressure; // 气压
|
|
|
|
/**
|
|
* 构造方法
|
|
* @param size 车轮尺寸
|
|
* @param type 车轮类型
|
|
* @param pressure 标准气压
|
|
*/
|
|
public Wheel(String size, String type, int pressure) {
|
|
this.size = size;
|
|
this.type = type;
|
|
this.pressure = pressure;
|
|
}
|
|
|
|
/**
|
|
* 检查轮胎气压
|
|
* @return 气压状态
|
|
*/
|
|
public boolean checkPressure() {
|
|
// 简单模拟检查逻辑
|
|
return pressure >= 30 && pressure <= 35;
|
|
}
|
|
|
|
// getter and setter methods
|
|
public String getSize() {
|
|
return size;
|
|
}
|
|
|
|
public void setSize(String size) {
|
|
this.size = size;
|
|
}
|
|
|
|
public String getType() {
|
|
return type;
|
|
}
|
|
|
|
public void setType(String type) {
|
|
this.type = type;
|
|
}
|
|
|
|
public int getPressure() {
|
|
return pressure;
|
|
}
|
|
|
|
public void setPressure(int pressure) {
|
|
this.pressure = pressure;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "Wheel [size=" + size + ", type=" + type + ", pressure=" + pressure + "]";
|
|
}
|
|
} |