Class CargoCar

java.lang.Object
  extended by CargoCar

public class CargoCar
extends java.lang.Object

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

name

private java.lang.String name

weight

private int weight

destination

private java.lang.String destination
Constructor Detail

CargoCar

public CargoCar(java.lang.String name,
                int weight,
                java.lang.String destination)
Construct an instance of CargoCar with name, weight and destination param.

Parameters:
cargo - name for what product is in this cargo car
weight - of the cargo product
destination - city for this cargo car
Method Detail

getName

public java.lang.String getName()
Get the cargo load name of this cargo car.

Returns:
cargo name of the product in this car

setCargoName

public void setCargoName(java.lang.String name)
Set a new cargo load name for this cargo car. Allows a car to be reused for a different type of cargo. Renaming cargo cars should not be necessary in this program.

Parameters:
The - new cargo name

getWeight

public int getWeight()
Get the weight of this cargo car.

Returns:
the weight of the cargo in this car

setWeight

public void setWeight(int weight)
Edit or change the weight of this cargo car

Parameters:
weight - cargo weight

getDestination

public java.lang.String getDestination()
Get the destination of this cargo car

Returns:
the destination of the cargo in this car

setDestination

public void setDestination(java.lang.String destination)
Edit/change the destination for this cargo car

Parameters:
the - new destination of this cargo car