Tuesday, October 26, 2010

LabTest#2 -- Section 6 -- Shopping Cart of Items


1) Create an Item class with a price and name attributes.  
 
2) Create Shirt, Pants, and Shoes classes, with added size attribute. Shirt sizes are S,M,L,XL. Pant and shoe sizes are integers.
 
3) Create a shopping cart which can hold up to 1000 Items,  
 
   with methods
:
 
   
  a
) addItem(Item e)
 
  b
) removeItem(Item e)
 
  c
) int calculateTotal() ;returns the total price
 
  d
) clear(); removes all items from the shopping cart
 
  e
) toString(); each item in one line.  
 
   
If an item is there more than once it should say
 
      quantity
=4 blue shirt
 
     rather than
"blue shirt" in 4 separate lines

No comments: