public class Driver
{
public static void main(String[] args)
{
Shirt shirt1 = new Shirt("blue shirt", 100, Shirt.Size.M);
Shirt shirt2 = new Shirt("blue shirt", 120, Shirt.Size.S);
Shirt shirt3 = new Shirt("maroon shirt", 130, Shirt.Size.L);
Pant pant1 = new Pant("brown pant", 65, 32);
Pant pant2 = new Pant("black pant", 130, 34);
Pant pant3 = new Pant("brown pant", 100, 33);
Shoes shoe1 = new Shoes("black shoe", 200, 8);
Shoes shoe2 = new Shoes("black shoe", 200, 8);
Shoes shoe3 = new Shoes("grey shoe", 200, 8);
/* **************************************************************** */
ShoppingCart Cart = new ShoppingCart();
Cart.addItems(shirt1);
Cart.addItems(shirt2);
Cart.addItems(shirt3);
Cart.addItems(pant1);
Cart.addItems(pant2);
Cart.addItems(pant3);
Cart.addItems(shoe1);
Cart.addItems(shoe2);
Cart.addItems(shoe3);
System.out.println("TOTAL PRICE = $" + Cart.calculateTotalPrice());
System.out.println("ITEMS BOUGHT: \n" + Cart.toString());
/* **************************************************************** */
Cart.removeItem(shirt3);
Cart.removeItem(pant2);
Cart.removeItem(shoe2);
System.out.println("TOTAL PRICE = $" + Cart.calculateTotalPrice());
System.out.println("ITEMS BOUGHT: \n" + Cart.toString());
/* ****************************************************************** */
Cart.clear();
System.out.println("TOTAL PRICE = $" + Cart.calculateTotalPrice());
System.out.println("ITEMS BOUGHT: \n" + Cart.toString());
/* ******************************************************************* */
Shirt shirt4 = new Shirt("green shirt", 130, Shirt.Size.L);
Pant pant4 = new Pant("green pant", 130, 34);
Shoes shoe4 = new Shoes("green shoe", 200, 8);
Cart.addItems(shirt4);
Cart.addItems(pant4);
Cart.addItems(shoe4);
System.out.println("TOTAL PRICE = $" + Cart.calculateTotalPrice());
System.out.println("ITEMS BOUGHT: \n" + Cart.toString());
/* ******************************************************************** */
}
}
Tuesday, October 26, 2010
LabTest#2 -- Section 6 -- Driver Class ( You can use this to test your program )
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment