title: Shopping cart program
body: <p>I've been working on my shopping cart program, but I keep having problems with entering itemTax in and with adding new items into cart and I don't know what I've done wrong. </p>
  
  <p>class Item:</p>
  
  <pre><code>public class Item {
  
  private int id;
  private String name;
  private double price;
  private String description;
  private int quantity;
  private double tax;
  
  public Item (int itemID, String itemName, double itemPrice, String itemDescription, int itemQuantity, double itemTax){
      id = itemID;
      name = itemName;
      price = itemPrice;
      description = itemDescription;
      quantity = itemQuantity;
      tax = itemTax;
  }
  
  public int getID(){
      return id;
  }
  
  public String getName(){
      return name;
  }
  
  public double getPrice(){
      return price;
  }
  
  public String getDescription(){
      return description;
  }
  
  public int getQuantity(){
      return quantity;
  }
  
  public double getTax(){
      return tax;
  }
  
  }
  </code></pre>
  
  <p>class Cart:</p>
  
  <pre><code>import java.util.Scanner;
  
  public class Cart {
  
  private int itemCount;
  private double totalPrice;
  private static int capacity;
  private static Item[] cart = new Item[capacity];
  
  public Cart(){
      itemCount = 10;
      totalPrice = 0.0;
      capacity = 0;
  }
  
  public void add(int itemID, String itemName, double itemPrice, String itemDescription, int itemQuantity, double itemTax){
      Item item = new Item(itemID, itemName, itemPrice, itemDescription, itemQuantity, itemTax);
      totalPrice += (itemPrice * itemQuantity);
      cart[itemCount] = item;
      itemCount += 1;
      if(itemCount==capacity)
      {
          increaseSize();
      }
  }
  
  public static void remove(String itemName){
      Scanner s = new Scanner(System.in);
  
      for (int i = 0; i &lt; cart.length; i++) {
          Item remove = (Item) cart.get(i);
          if (itemName.equals(remove.getName())) {
              cart.remove(i);
  
          }
      }
      System.out.println("\n" + "Item " + itemName + " wasn't found.");
  }
  
  private void increaseSize()
  {
      Item[] item = new Item[capacity+5];
      for(int i=0; i &lt; capacity; i++)
      {
          item[i] = cart[i];
      }
      cart = item; 
      item = null;
      capacity = cart.length;
  }
  
  public static void prLine (int itemID, String itemName, int itemQuantity, double itemPrice, double total, double itemTax) {
      System.out.printf("\n%-10.10d %30s %10.2f %10d %10.2f", itemID, itemName, itemPrice, itemQuantity, itemTax, total);
  }   
  
  public static void prTitles () {
      System.out.printf("\n%-10s 30% %10s %10s %10s %10s", "ID", "Item", "Price", "Quantity", "Tax", "Total");
  }
  
  
  
  }
  </code></pre>
  
  <p>class Shop:</p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.Scanner;
  
  public class Shop {
  public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      ArrayList&lt;Item&gt; cart = new ArrayList&lt;Item&gt;();
  
      Item item;
      int itemID;
      String itemName;
      double itemPrice;
      String itemDescription;
      int itemQuantity;
      double itemTax;
      int ch;
      String choice;
  
      Cart shoppingCart = new Cart();
  
      while (true) {
          System.out.println("Menu:");
          System.out.println("0) Exit " + "\n"
                  + "1) Add item in shopping cart" + "\n"
                  + "2) Remove item from shpping cart");
          ch = sc.nextInt();
  
          switch (ch) {
          case 0:
              System.out.println("\n" + "Good bye!");
              System.exit(0);
  
          case 1:
              System.out.println("Enter item ID: ");
              itemID = sc.nextInt();
  
              System.out.println("Enter item name: ");
              itemName = sc.next();
  
              System.out.println("Enter item price: ");
              itemPrice = sc.nextDouble();
  
              System.out.println("Enter short description of item: ");
              itemDescription = sc.next();
  
              System.out.println("Enter quantity: ");
              itemQuantity = sc.nextInt();
  
              System.out.println("Enter tax rate:");
              itemTax = sc.nextDouble();
  
  
              shoppingCart.add(itemID, itemName, itemPrice, itemDescription, itemQuantity,       itemTax);
  
              break;
  
          case 2:
              System.out.println("Enter name of the item that you would like to remove: ");
              choice = sc.next();
              shoppingCart.remove(choice);
  
              break;
          }
  
      }
  }
  
  }
  </code></pre>