|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Taxi
Defines the class of Taxi objects, which can pick up passengers and drive around at certain rates accruing money. The taxi is sent out at the start of a day and given a driver, and returns at the end of a day to deposit the earnings. Bugs: none known
Main.java
Field Summary | |
static double |
STANDARD_RATE
The standard fare, in dollars per miles |
static double |
STUDENT_RATE
The discounted student fare, in dollars per miles |
Constructor Summary | |
Taxi(int carNumber)
Constructs a Taxi objects with the specified car number. |
Method Summary | |
void |
drive(int miles)
A public method to drive around a specified number of miles. |
void |
dropOffPeople()
A public method to drop off passengers that it might have, and sets the rate back to the zero rate |
int |
getCarNumber()
An accessor for the car number |
double |
getCurrentRate()
An accessor for the current rate |
java.lang.String |
getDriverName()
An accessor for the driver name |
double |
getTotalMoneyEarned()
An accessor for the total money earned thus far |
void |
pickUpPeople(double rate)
A public method to pick up passengers assigned at a specified rate, and sets the current rate to it |
void |
startWorkDay(java.lang.String driverName)
The public method that begins the Taxi's work day, given a specified driver. |
void |
stopWorkDay()
The public method that ends the Taxi's work day, reseting the driver to the default value |
java.lang.String |
toString()
The overriden method inherited from the Object class. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final double STANDARD_RATE
public static final double STUDENT_RATE
Constructor Detail |
public Taxi(int carNumber)
carNumber
- The number of the carMethod Detail |
public int getCarNumber()
public java.lang.String getDriverName()
public double getCurrentRate()
public double getTotalMoneyEarned()
public void startWorkDay(java.lang.String driverName)
driverName
- The name of the driver for that daypublic void stopWorkDay()
public void pickUpPeople(double rate)
rate
- The new fare rate for the Taxipublic void dropOffPeople()
public void drive(int miles)
miles
- The number of miles to drivepublic java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |