// Program Name                  Shop.java
// Course:                       CSE 1302J
// Student Name:                 Bradley Shedd
// Assignment Number:            Lab 2
// Due Date:                     09/1/2010
// Purpose:                      This program will calculate the number of items in a shoppong cart               
//
//
//
// *******************************************************************// ***************************************************************
//   Shop.java
//
//   Uses the Item class to create items and add them to a shopping
//   cart stored in an ArrayList.
// ***************************************************************


import java.util.Scanner;

public class Shop
{
   
public static void main (String[] args)
    {
   ShoppingCart cart =
new ShoppingCart();

   Item item;
   String itemName;
  
double itemPrice;
  
int quantity;

   Scanner scan =
new Scanner(System.in);

   String keepShopping =
"y";

  
do
       {
      System.out.print (
"Enter the name of the item: ");
      itemName = scan.next();

      System.out.print (
"Enter the unit price: ");
      itemPrice = scan.nextDouble();

      System.out.print (
"Enter the quantity: ");
      quantity = scan.nextInt();
     

     
// *** create a new item and add it to the cart
     
      cart.addToCart(itemName, itemPrice, quantity);
        

     
// *** print the contents of the cart object using println
      System.out.println(cart);

      System.out.println(
"Continue shopping (y/n)? ");
      keepShopping = scan.next();
     }
 
while (keepShopping.equals("y"));
  
    System.out.print(
"\nPlease pay:" + cart.getTotalPrice());
    System.out.print(
"\nThis program coded by: Bradley J. Shedd.");

    }
}

Homepage