Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

get exit string game class

By: ace on Apr 15th, 2010  |  syntax: None  |  size: 1.06 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  
  2. /**
  3.  * Write a description of class Item here.
  4.  *
  5.  * @author (your name)
  6.  * @version (a version number or a date)
  7.  */
  8. public class Item
  9. {
  10.     // instance variables - replace the example below with your own
  11.     private int itemWeight;
  12.     private String itemDescription;
  13.     private boolean carried;
  14.     /**
  15.      * Constructor for objects of class Item
  16.      */
  17.     public Item(String itemDescription, int itemWeight)
  18.     {
  19.         // initialise instance variables
  20.        this.itemDescription = itemDescription;
  21.        this.itemWeight = itemWeight;
  22.        carried = false;
  23.        
  24.     }
  25.  
  26.     /**
  27.      * returns a string for the items description
  28.      */
  29.     public String getItemDescription()
  30.     {
  31.         return itemDescription;
  32.     }
  33.    
  34.     public int getItemWeight()
  35.     {
  36.         return itemWeight;
  37.     }
  38.    
  39.     public void pickUpItem()
  40.     {
  41.         if(Game.getEncumberance() < Game.carriedWeight)
  42.             {
  43.                 carried = true;
  44.                 Game.carriedWeight += itemWeight;
  45.             }
  46.         }
  47.    
  48. }