import java.text.NumberFormat;
import java.util.Scanner;
public class ShoppingCart
{
private int itemCount; // total number of items in the cart
private double totalPrice; // total price of items in the cart
private int capacity; // current cart capacity
Item[] cart = new Item[capacity]; // New array called cart that holds capacity items.
String end;
// -----------------------------------------------------------
// Creates an empty shopping cart with a capacity of 5 items.
// -----------------------------------------------------------
public ShoppingCart()
{
capacity = 5;
itemCount = 0;
totalPrice = 0.0;
cart = new Item[capacity];
}
// -------------------------------------------------------
// Adds an item to the shopping cart.
// -------------------------------------------------------
public void addToCart(String itemName, double price, int quantity)
{
Item item = new Item(itemName, price, quantity);
if (itemCount < capacity)
cart[itemCount] = item;
totalPrice += (price * quantity);
itemCount++;
}