title: Making a grocery basket
body: <p>So i'm trying to create a program that allows the user to put items inside a grocery basket.</p>
  
  <ul>
  <li>Step 1:Users should be able to add a grocery item with the name and the price. </li>
  <li>Step 2:No duplicate name should be added on the basket</li>
  <li>Step 3:Users should be able to remove a grocery item given the name.</li>
  <li>Step 4:Users should be able to see all the contents of the basket.</li>
  </ul>
  
  <p>I know i'm almost done, but I'm stuck with step step 3 and 4, any suggestions?</p>
  
  <p>this is my code</p>
  
  <pre><code>public class Main {
  
  public static void main(String[] args) {
  
  Scanner myReader = new Scanner(System.in);    
  
      while (true) {
      System.out.println("What would you want to do today?");
      System.out.println("(A)dd grocery item\n(R)emove grocery item\n(S)ee all items"); 
      System.out.println("Enter Command: ");
      String toDo = myReader.nextLine();
  
          if (toDo.equals("A")) {
              System.out.print("New Item Name: ");
              String grocery = myReader.nextLine();
              GroceryPackage grocery1 = new GroceryPackage();
              grocery1.addGrocery(grocery);
              System.out.print("New Item Price: ");
              String groceryPrice = myReader.nextLine();
              grocery1.addGrocery(groceryPrice);
              System.out.println("Added new item Succesfully!");
  
          }
          if (toDo.equals("R")) {
              System.out.print("Name of the Item you want to Remove: ");
              String removeItem = myReader.nextLine();
              removeItem.removeGrocery(grocery);
  
  
          }
          if (toDo.equals("S")) {
              System.out.print(GroceryPackage);
          }
  
          System.out.println("Thanks!");
      }
  
  
  }
  
  
  }
  
  public class GroceryPackage {
  private String addGrocery;
  private boolean groceryPrice;
  private String removeGrocery;
  private String grocery1;
  
  
  public void setGrocery1(String grocery1) {
      this.grocery1 = grocery1;
  
  }
  
  public void setListofGrocery(ArrayList&lt;String&gt; listofGrocery) {
      this.listofGrocery = listofGrocery;
  }
  private ArrayList&lt;String&gt; listofGrocery;
  
  public GroceryPackage(String addGrocery, boolean groceryPrice) {
      this.addGrocery = addGrocery;
      this.groceryPrice = groceryPrice;                
  }
  
  public GroceryPackage() {
      this.listofGrocery = new ArrayList&lt;String&gt;();
  }
  
  public void addGrocery(String grocery){
      if (!this.listofGrocery.contains(grocery)){
          this.listofGrocery.add(grocery);
      }
  }
  
  public void printGrocery(){
      for (String food: this.listofGrocery){
          System.out.println(food);
      }
  }
  
  public void removeGrocery(){
      this.listofGrocery.clear();
  }
  
  public void setAddGrocery(String addGrocery) {
      this.addGrocery = addGrocery;
  }
  
  public void setGroceryPrice(boolean groceryPrice) {
      this.groceryPrice = groceryPrice;
  }
  
  public void setRemoveGrocery(String removeGrocery) {
      this.removeGrocery = removeGrocery;
  }
  
  public String getAddGrocery() {
      return addGrocery;
  }
  
  public boolean getGroceryPrice() {
      return groceryPrice;
  }
  
  public String getRemoveGrocery() {
      return removeGrocery;
  }
  }
  </code></pre>
  
  <p>and it should run like this:</p>
  
  <pre><code>What would you want to do today?
  (A)dd grocery item
  (R)emove grocery item?
  (S)ee all items?
  A
  New Item name:
  Carrot
  New Item price:
  100
  Added new item successfully
  What would you want to do today?
  (A)dd grocery item
  (R)emove grocery item?
  (S)ee all items?
  A
  New Item name:
  Pineapple
  New Item price:
  20
  Added new item successfully
  What would you want to do today?
  (A)dd grocery item
  (R)emove grocery item?
  (S)ee all items?
  R
  Name of item you want to remove:
  Pineapple
  Removed new item successfully
  What would you want to do today?
  (A)dd grocery item
  (R)emove grocery item?
  (S)ee all items?
  S
  Carrot , P100.0
  
  What would you want to do today?
  (A)dd grocery item
  (R)emove grocery item?
  (S)ee all items?
  </code></pre>