package class3_2_InheritanceVehicles;// Dr. Yoder. MSOE. 08 December 2016 public class Vehicle { public static final int DEFAULT_NORTH_METERS_PER_SEC = 4; /** The car's position */ private double northMeters; /** The car's speed */ private double northMetersPerSec; /** Create a car at the specied position with the specified initial velocity * * @param northMeters position north of game center of vehicle's center of mass * @param northMetersPerSec velocity north of game center of vehicle's * center of mass, in m/s. */ public Vehicle(double northMeters, double northMetersPerSec) { System.out.println("Veh 2 arg"); this.northMeters = northMeters; this.northMetersPerSec = northMetersPerSec; } /** * Create a car at the specified position. * The vehicle will be moving north by default at about 10mph * @param northMeters position north of game center of vehicle's center of mass */ public Vehicle(double northMeters) { this(northMeters, DEFAULT_NORTH_METERS_PER_SEC); System.out.println("Veh 1 arg"); } public double getNorthMeters() { return northMeters; } /** * Step forward the simulation by one second. */ public void step() { northMeters += northMetersPerSec; } /** * Describe the vehicle and its location * @return a string representation of the object. */ @Override public String toString() { return "A vehicle at "+northMeters+" meters north"; } public void speak() { System.out.println("I'm a car! At "+getNorthMeters()+ "m north"); } }