|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object assign5.DeliveryTruck
public class DeliveryTruck
Constructor Summary | |
---|---|
DeliveryTruck()
Creates a new instance of DeliveryTruck. |
|
DeliveryTruck(java.lang.String id)
Creates a new instance of DeliveryTruck Given truck id rest takes defaults |
|
DeliveryTruck(java.lang.String id,
java.lang.String startLoc)
Creates a new instance of DeliveryTruck Given truck id and location rest takes defaults |
|
DeliveryTruck(java.lang.String id,
java.lang.String startLoc,
int holding)
Creates a new instance of DeliveryTruck Given truck id and location and current contents of truck rest takes defaults |
Method Summary | |
---|---|
boolean |
addBoxesDelivered(int boxes)
Add to the truck's number of boxes delivered. |
boolean |
addContains(int number)
Add to the truck contents. |
boolean |
addDistanceDriven(int dist)
Add to the truck's number of units traveled. |
boolean |
dropoff(int boxes)
Very controlled handling of package dropoff. |
int |
getBoxesDelivered()
Report the number of boxes delivered since the start of the game / simulation |
int |
getContains()
report the contents of the truck - in number of boxes |
java.lang.String |
getCurrLoc()
Report the current location of the truck |
int |
getDistanceDriven()
Report the number of miles driven |
double |
getProfit()
report profit for the truck - based on constants defined in class and truck activity - miles driven and boxes delivered. |
java.lang.String |
getTruckID()
report the unique (we hope) identifier of the truck |
void |
resetBoxesDelivered()
Reset number of boxes delivered to the begining - 0 |
void |
resetContainsd()
Reset number of boxes on the truck to the begining - 0 |
void |
resetDistanceDriven()
Reset distance traveled to the begining - 0 |
void |
setCurrLoc(java.lang.String newLoc)
Change the truck location to a new place no validation done - all locations accepted |
void |
setTruckID(java.lang.String id)
Change the truck id to a new value no validation done - all ids accepted |
boolean |
subtractContains(int number)
Subtract from the truck contents. |
java.lang.String |
toString()
produce a display friendly reprentation of a truck |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DeliveryTruck()
public DeliveryTruck(java.lang.String id)
public DeliveryTruck(java.lang.String id, java.lang.String startLoc)
public DeliveryTruck(java.lang.String id, java.lang.String startLoc, int holding)
Method Detail |
---|
public java.lang.String getTruckID()
public int getContains()
public java.lang.String getCurrLoc()
public int getBoxesDelivered()
public int getDistanceDriven()
public double getProfit()
public void setTruckID(java.lang.String id)
public void setCurrLoc(java.lang.String newLoc)
public boolean addBoxesDelivered(int boxes)
public void resetBoxesDelivered()
public boolean addContains(int number)
public boolean subtractContains(int number)
public void resetContainsd()
public boolean addDistanceDriven(int dist)
public void resetDistanceDriven()
public boolean dropoff(int boxes)
public 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 |