Source of Item.java


  1: /** A class of items for sale.
  2:     @author Frank M. Carrano
  3:     @version 4.0
  4: */
  5: public class Item
  6: {
  7:    private String description;
  8:    private int    price;
  9:    
 10:         public Item(String productDescription, int productPrice) 
 11:         {
 12:       description = productDescription;
 13:       price = productPrice;
 14:         } // end constructor
 15:         
 16:         public String getDescription() 
 17:         {
 18:       return description;
 19:         } // end getDescription
 20:         public int getPrice() 
 21:         {
 22:       return price;
 23:         } // end getPrice
 24:         
 25:         public String toString() 
 26:         {
 27:       return description + "\t$" + price / 100 + "." + price % 100;
 28:         } // end toString
 29: } // end Item