class Car { String licensePlate; // e.g. "New York A456 324" double speed; // kilometers per hour double maxSpeed; // kilometers per hour Car() { this.licensePlate = ""; this.speed = 0.0; this.maxSpeed = 120.0; } Car(String licensePlate, double speed, double maxSpeed) { this.licensePlate = licensePlate; this.speed = speed; this.maxSpeed = maxSpeed; } Car(String licensePlate, double maxSpeed) { this.licensePlate = licensePlate; this.speed = 0.0; this.maxSpeed = maxSpeed; } // getter (accessor) methods String getLicensePlate() { return this.licensePlate; } double getMaxSpeed() { return this.maxSpeed; } double getSpeed() { return this.speed; } // setter method for the license plate property void setLicensePlate(String licensePlate) { this.licensePlate = licensePlate; } // accelerate to maximum speed // put the pedal to the metal void floorIt() { this.speed = this.maxSpeed; } void accelerate(double deltaV) { this.speed = this.speed + deltaV; if (this.speed > this.maxSpeed) { this.speed = this.maxSpeed; } if (this.speed < 0.0) { this.speed = 0.0; } } } class CarTest4 { public static void main(String args[]) { Car c = new Car("New York A45 636", 123.45); System.out.println(c.licensePlate + " is moving at " + c.speed + " kilometers per hour."); for (int i = 0; i < 15; i++) { c.accelerate(10.0); System.out.println(c.licensePlate + " is moving at " + c.speed + " kilometers per hour."); } } }