📄 exp3_1.java
字号:
public class EXP3_1
{
String ownerName;
float speed;
float dirInDegree;
//定义私有的,非静态的成员变量表示车主姓名、当前的速率和当前方向盘的转向//角度
public EXP3_1(String ownerName){
this.ownerName=ownerName;//定义构造方法
}
public EXP3_1(String ownerName, float speed, float dirInDegree){
this(ownerName);
this.speed =speed;//定义构造方法
this.dirInDegree = dirInDegree;
}
public String getOwnerName()
{ return ownerName;
}
public float getspeed(float speed)
{ return this.speed=speed;//定义公有方法获得当前的速率
}
public float getdirInDegree(float dirInDegree )
{ return this.dirInDegree=dirInDegree;//定义公有方法获得当前方向盘的转向角度
}
public float changespeed(float newspeed)
{
return this.speed=newspeed;//定义公有方法改变当前的车速
}
public void stop()
{ speed=0;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -