Source of Item.java


  1: /** Item.java
  2:     A class of items for sale.
  3:     @author Frank M. Carrano
  4:     @version 4.0
  5: */
  6: public class Item
  7: {
  8:     private String description;
  9:     private int price;

 11:     public Item(String productDescription, int productPrice)
 12:     {
 13:         description = productDescription;
 14:         price = productPrice;
 15:     }

 17:     public String getDescription()
 18:     {
 19:         return description;
 20:     }

 22:     public int getPrice()
 23:     {
 24:         return price;
 25:     }

 27:     public String toString()
 28:     {
 29:         return description + "\t$" + price / 100 + "." + price % 100;
 30:     }
 31: }