Java类与对象汽车类

#设计一个用来描述汽车的类,使用类的非静态成员变量来表示汽车的车主姓名、当前的速率和当前方向盘的转向角度,使用类的非静态成员方法来表示改变汽车的速率和停车两个操作。在下图中的1、 2、 3处填入正确代码使程序可以正确输出。

输入格式:

输出格式:
车主:bob,速度:0.0,角度:0.0
车主:bob,速度:10.0,角度:0.0
车主:bob,速度:0.0,角度:0.0


/**
 * @author Teacher
 *         主类,用来在pta中运行。
 *         其中有一处代码需要完善
 */
public class Main {
  public static void main(String[] args) {

    // 此处填写合适的代码【1】
    // 生成汽车实例
    
    System.out.printf("车主:%s,速度:%.1f,角度:%.1f\n", car.getOwnerName(), car.getCurSpeed(), car.getCurDirInDegree());

    // 设置新速度
    car.changeSpeed(10);
    System.out.printf("车主:%s,速度:%.1f,角度:%.1f\n", car.getOwnerName(), car.getCurSpeed(), car.getCurDirInDegree());

    // 停车
    car.stop();
    System.out.printf("车主:%s,速度:%.1f,角度:%.1f\n", car.getOwnerName(), car.getCurSpeed(), car.getCurDirInDegree());

  }
}

/**
 * @author Teacher
 *         汽车类,其中有两个内容需要完善。
 */
class Car {
  // 车主姓名
  private String ownerName;
  // 当前车速
  private float curSpeed;
  // 当前方向盘转向角度
  private float curDirInDegree;

  public Car(String ownerName) {
    this.ownerName = ownerName;
  }

  public Car(String ownerName, float speed, float dirInDegree) {
    this(ownerName);
    this.curSpeed = speed;
    this.curDirInDegree = dirInDegree;
  }

  // 提供对车主姓名的访问
  public String getOwnerName() {
    return ownerName;
  }

  // 提供对当前方向盘转向角度的访问
  public float getCurDirInDegree() {
    return curDirInDegree;
  }

  // 提供对当前车速的访问
  public float getCurSpeed() {
    return curSpeed;
  }

  // 提供改变当前的车速
  public void changeSpeed(float curSpeed) {
    // 此处填写合适的代码【2】
    
  }

  // 提供停车
  public void stop() {
    // 此处填写合适的代码【3】
   
  }
}


1 Car car = new Car("bob",0,0);
2 this.curSpeed = curSpeed;
3 this.curSpeed = 0;

1 Car car = new Car(name,11.0,35);
2 this.curSpeed = curSpeed;
3 this.curSpeed = 0;

如果有帮助,麻烦点下接纳