
get exit string game class
By:
ace on
Apr 15th, 2010 | syntax:
None | size: 1.06 KB | hits: 9 | expires: Never
/**
* Write a description of class Item here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Item
{
// instance variables - replace the example below with your own
private int itemWeight;
private String itemDescription;
private boolean carried;
/**
* Constructor for objects of class Item
*/
public Item(String itemDescription, int itemWeight)
{
// initialise instance variables
this.itemDescription = itemDescription;
this.itemWeight = itemWeight;
carried = false;
}
/**
* returns a string for the items description
*/
public String getItemDescription()
{
return itemDescription;
}
public int getItemWeight()
{
return itemWeight;
}
public void pickUpItem()
{
if(Game.getEncumberance() < Game.carriedWeight)
{
carried = true;
Game.carriedWeight += itemWeight;
}
}
}