Class Taxi

java.lang.Object
  |
  +--Taxi

public class Taxi
extends java.lang.Object

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

See Also:
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

STANDARD_RATE

public static final double STANDARD_RATE
The standard fare, in dollars per miles

See Also:
Constant Field Values

STUDENT_RATE

public static final double STUDENT_RATE
The discounted student fare, in dollars per miles

See Also:
Constant Field Values
Constructor Detail

Taxi

public Taxi(int carNumber)
Constructs a Taxi objects with the specified car number. DriverName, totalMoneyEarned, and currentRate are alll given initial empty or zero values.

Parameters:
carNumber - The number of the car
Method Detail

getCarNumber

public int getCarNumber()
An accessor for the car number

Returns:
The car number

getDriverName

public java.lang.String getDriverName()
An accessor for the driver name

Returns:
The driver name

getCurrentRate

public double getCurrentRate()
An accessor for the current rate

Returns:
The current fare rate

getTotalMoneyEarned

public double getTotalMoneyEarned()
An accessor for the total money earned thus far

Returns:
The total money earned thus far

startWorkDay

public void startWorkDay(java.lang.String driverName)
The public method that begins the Taxi's work day, given a specified driver. Resets the total money earned

Parameters:
driverName - The name of the driver for that day

stopWorkDay

public void stopWorkDay()
The public method that ends the Taxi's work day, reseting the driver to the default value


pickUpPeople

public void pickUpPeople(double rate)
A public method to pick up passengers assigned at a specified rate, and sets the current rate to it

Parameters:
rate - The new fare rate for the Taxi

dropOffPeople

public void dropOffPeople()
A public method to drop off passengers that it might have, and sets the rate back to the zero rate


drive

public void drive(int miles)
A public method to drive around a specified number of miles. The total money earned will increase based upon the current rate per mile

Parameters:
miles - The number of miles to drive

toString

public java.lang.String toString()
The overriden method inherited from the Object class. Provides a String summary of this Taxi object

Overrides:
toString in class java.lang.Object