@Test public void testGetSpeedMph(){ double timeSec = 10.0; int engineHorsePower = 246; int vehicleWeightPounds = 4000; Engine engine = new Engine(); engine.setHorsePower(engineHorsePower); Vehicle vehicle = new Vehicle(vehicleWeightPounds, engine); double speed = vehicle.getSpeedMph(timeSec); assertEquals("Assert vehicle (" + engineHorsePower + " hp, " + vehicleWeightPounds + " lb) speed in " + timeSec + " sec: ", 117, speed, 0.001 * speed); }
protected double getSpeedMph(double timeSec){ double v = 2.0*this.engine.getHorsePower()*746; v = v*timeSec*32.174/this.weightPounds; return Math.round(Math.sqrt(v)*0.68); }
Vehicle { protected double getSpeedMph(double timeSec){ double v = 2.0*this.engine.getHorsePower()*746; v = v*timeSec*32.174/this.weightPounds; return Math.round(Math.sqrt(v)*0.68); } }
Vehicle { protected double getSpeedMph(double timeSec){ double v = 2.0*this.engine.getHorsePower()*746; v = v*timeSec*32.174/this.weightPounds; return Math.round(Math.sqrt(v)*0.68); } Vehicle(int weightPounds, Engine engine); }
Vehicle { protected double getSpeedMph(double timeSec){ double v = 2.0*this.engine.getHorsePower()*746; v = v*timeSec*32.174/this.weightPounds; return Math.round(Math.sqrt(v)*0.68); } Vehicle(int weightPounds, Engine engine); int getWeightPounds(); Engine getEngine(); }
Vehicle { protected double getSpeedMph(double timeSec){ double v = 2.0*this.engine.getHorsePower()*746; v = v*timeSec*32.174/this.weightPounds; return Math.round(Math.sqrt(v)*0.68); } Vehicle(int weightPounds, Engine engine); int getWeightPounds(); Engine getEngine();  }