|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectCargo
public class Cargo
This class represents the cargo within our game.
| Field Summary | |
|---|---|
private int |
amount
The number of units of this cargo |
private double |
cost
The base price of the cargo |
private java.lang.String |
type
The type of the cargo: 'gold', 'silver', 'Java textbooks', etc. |
| Constructor Summary | |
|---|---|
Cargo()
The default constructor,it creates default cargo by initializing the type, amount, and the cost to random values |
|
| Method Summary | |
|---|---|
int |
getAmount()
Get the Amount value. |
double |
getCost()
Get the Cost value. |
double |
getTotalPrice(double costFactor)
Returns the total price of the cargo. |
java.lang.String |
getType()
Get the Type value. |
void |
setAmount(int newAmount)
Set the Amount value. |
void |
setCost(double newCost)
Set the Cost value. |
void |
setType(java.lang.String newType)
Set the Type value. |
java.lang.String |
toString()
Returns the cargo represented as a String |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private java.lang.String type
private int amount
private double cost
| Constructor Detail |
|---|
public Cargo()
| Method Detail |
|---|
public java.lang.String getType()
public void setType(java.lang.String newType)
newType - The new Type value.public int getAmount()
public void setAmount(int newAmount)
newAmount - The new Amount value.public double getCost()
public void setCost(double newCost)
newCost - The new Cost value.public java.lang.String toString()
toString in class java.lang.Objectpublic double getTotalPrice(double costFactor)
costFactor - The cost factor to be used in the computation
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||