java.lang.ObjectCar
public class Car
A class of Car objects that can move forward, backward and turn
Constructor Summary | |
---|---|
Car()
Default constructor for a Car object |
|
Car(java.lang.String name)
Constructor for a Car object with a new owner’s name |
Method Summary | |
---|---|
int |
getOdometer()
getOdometer gets the odometer reading of a car |
void |
moveCar(int dist)
moveCar moves a car forward or backward by dist units |
void |
turnCar(double angle)
turnCar turns a car by a given degree |
Methods inherited from class |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Car()
public Car(java.lang.String name)
name
- name of ownerMethod Detail |
---|
public int getOdometer()
public void moveCar(int dist)
dist
- Moving distancepublic void turnCar(double angle)
angle
- Turn angle in degrees