A类:
package projsp3;
  
   public class Item {
        private String itemId;
    private float price;
    private String description;
    private boolean available;
    private int quantity_in_stock;
  
    public Item(String itemId,String description,float price,boolean available,int quantity_in_stock){
      this.itemId=itemId;
      this.description=description;
      this.price=price;
      this.available=available;
      this.quantity_in_stock=quantity_in_stock;
    }
   
   public String getItemId(){
     return itemId;
    }
   
   public void setItemId(String aItemId){
     itemId=aItemId;
     }
   
   public float getPrice(){
     return price;
    }
   
   public String getDescription(){
     return description;
    }   public boolean getAvailable(){
     return available;
    }   public void setAvailable(boolean aAvailable){
     available=aAvailable;
    }   public int getQuantity_in_stock(){
     return quantity_in_stock;
    }   public void setQuantity_in_stock(int aQuantity_in_stock){
      quantity_in_stock=aQuantity_in_stock;
    }
  }
 b类:
package projsp3;
import java.util.Vector;
 
 public class Catalog{
  private Vector items=new Vector();
    synchronized public Vector getItems(){
     return items;
   }
  
  synchronized public Item getItem(String itemId){
     int index=Integer.parseInt(itemId);
     return (Item)items.elementAt(index);
     }
  
  synchronized public void setItem(Item item,String itemId){
     int index=Integer.parseInt(itemId);
     items.set(index,item);
     }
   
  public Catalog(){
    
    items.addElement(new Item("0","Toothbrush",(float)10,true,100));
    items.addElement(new Item("1","Comb",(float)1,true,100));
    items.addElement(new Item("2","Razor",(float)13,true,1000)); 
    items.addElement(new Item("3","After shave",(float)10,true,900));
    items.addElement(new Item("4","Cologne",(float)25,true,133));
    items.addElement(new Item("5","shaving cream",(float)12,true,353));
    items.addElement(new Item("6","Razor blades",(float)9,true,333));
    items.addElement(new Item("7","Pen stand",(float)0.99,true,222));
    items.addElement(new Item("8","Duke beanie",(float)19,true,343)); 
    items.addElement(new Item("9","Elec Razor",(float)100,true,884));
     }
   }