|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectCargoCar
public class CargoCar
This class represents a single train car. It has a single cargo product which is identified by the name. The weight of the cargo and its destination are also tracked. DO NOT EDIT OR HAND IN THIS CLASS
Field Summary | |
---|---|
private java.lang.String |
destination
|
private java.lang.String |
name
|
private int |
weight
|
Constructor Summary | |
---|---|
CargoCar(java.lang.String name,
int weight,
java.lang.String destination)
Construct an instance of CargoCar with name, weight and destination param. |
Method Summary | |
---|---|
java.lang.String |
getDestination()
Get the destination of this cargo car |
java.lang.String |
getName()
Get the cargo load name of this cargo car. |
int |
getWeight()
Get the weight of this cargo car. |
void |
setCargoName(java.lang.String name)
Set a new cargo load name for this cargo car. |
void |
setDestination(java.lang.String destination)
Edit/change the destination for this cargo car |
void |
setWeight(int weight)
Edit or change the weight of this cargo car |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.lang.String name
private int weight
private java.lang.String destination
Constructor Detail |
---|
public CargoCar(java.lang.String name, int weight, java.lang.String destination)
cargo
- name for what product is in this cargo carweight
- of the cargo productdestination
- city for this cargo carMethod Detail |
---|
public java.lang.String getName()
public void setCargoName(java.lang.String name)
The
- new cargo namepublic int getWeight()
public void setWeight(int weight)
weight
- cargo weightpublic java.lang.String getDestination()
public void setDestination(java.lang.String destination)
the
- new destination of this cargo car
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |