Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need to add code for removing from cart in java using netbean. Cart.java * To

ID: 3705845 • Letter: I

Question



I need to add code for removing from cart in java using netbean.

Cart.java

* To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package model;
import java.util.List; import java.util.ArrayList;
/** * * */ public class Cart {    // Item Number private int _itemNumber; // The items private List<Food> _itemsFood = new ArrayList<Food>(); private List <Food.FoodSize> _itemsFoodSize = new ArrayList<Food.FoodSize>(); private List<Showing> _itemsShowing = new ArrayList<Showing>(); private ArrayList<Payment.paymentType> _getpayment = new ArrayList<Payment.paymentType>();    // Item Number constructor public Cart(int itemNumber){ this._itemNumber = itemNumber; }    // Get Item Number public int getItemNumber(){ return _itemNumber; }    // Get Iteams public List<Food> getItemsFood(){ return _itemsFood; } public List<Food.FoodSize> getItemsFoodSize(){ return _itemsFoodSize; } public List<Showing> getItemsShowing(){ return _itemsShowing; } // Set Item Number public int setItemNumber(){ return _itemNumber; }    // Set Items public void addItems(Food item, Food.FoodSize size){ this._itemsFood.add(item); this._itemsFoodSize.add(size); } public void addShowing(Showing showing, int count){ this._itemsShowing.add(showing); _itemNumber = _itemNumber + count; } // remove }



Carthelper.java


* To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package model;
import model.Food; import model.Cart; import model.FoodHelper; import model.IDataStorage;
/** * * */ public class CartHelper {    private static FakeDataStorage _storeCart = new FakeDataStorage(); private int count = 0; private Cart cart = new Cart(count); public void CartAddFood(Food food, Food.FoodSize size){ cart.addItems(food, size); count ++; }    private void CartAddShowing(Showing showing, int count){ cart.addShowing(showing, count); }       private void checkout(Cart cart, Payment payment){ System.out.println("Total food you are purchasing:" + cart.getItemsFood()); System.out.println("The movie you are purchasing:" + cart.getItemsShowing()); System.out.println("Which payment method are you using?" + payment.getPaymentType()); } }


I need to add code for removing from cart in java using netbean.

Cart.java

* To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package model;
import java.util.List; import java.util.ArrayList;
/** * * */ public class Cart {    // Item Number private int _itemNumber; // The items private List<Food> _itemsFood = new ArrayList<Food>(); private List <Food.FoodSize> _itemsFoodSize = new ArrayList<Food.FoodSize>(); private List<Showing> _itemsShowing = new ArrayList<Showing>(); private ArrayList<Payment.paymentType> _getpayment = new ArrayList<Payment.paymentType>();    // Item Number constructor public Cart(int itemNumber){ this._itemNumber = itemNumber; }    // Get Item Number public int getItemNumber(){ return _itemNumber; }    // Get Iteams public List<Food> getItemsFood(){ return _itemsFood; } public List<Food.FoodSize> getItemsFoodSize(){ return _itemsFoodSize; } public List<Showing> getItemsShowing(){ return _itemsShowing; } // Set Item Number public int setItemNumber(){ return _itemNumber; }    // Set Items public void addItems(Food item, Food.FoodSize size){ this._itemsFood.add(item); this._itemsFoodSize.add(size); } public void addShowing(Showing showing, int count){ this._itemsShowing.add(showing); _itemNumber = _itemNumber + count; } // remove }



Carthelper.java


* To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package model;
import model.Food; import model.Cart; import model.FoodHelper; import model.IDataStorage;
/** * * */ public class CartHelper {    private static FakeDataStorage _storeCart = new FakeDataStorage(); private int count = 0; private Cart cart = new Cart(count); public void CartAddFood(Food food, Food.FoodSize size){ cart.addItems(food, size); count ++; }    private void CartAddShowing(Showing showing, int count){ cart.addShowing(showing, count); }       private void checkout(Cart cart, Payment payment){ System.out.println("Total food you are purchasing:" + cart.getItemsFood()); System.out.println("The movie you are purchasing:" + cart.getItemsShowing()); System.out.println("Which payment method are you using?" + payment.getPaymentType()); } }


I need to add code for removing from cart in java using netbean.

Cart.java

* To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package model;
import java.util.List; import java.util.ArrayList;
/** * * */ public class Cart {    // Item Number private int _itemNumber; // The items private List<Food> _itemsFood = new ArrayList<Food>(); private List <Food.FoodSize> _itemsFoodSize = new ArrayList<Food.FoodSize>(); private List<Showing> _itemsShowing = new ArrayList<Showing>(); private ArrayList<Payment.paymentType> _getpayment = new ArrayList<Payment.paymentType>();    // Item Number constructor public Cart(int itemNumber){ this._itemNumber = itemNumber; }    // Get Item Number public int getItemNumber(){ return _itemNumber; }    // Get Iteams public List<Food> getItemsFood(){ return _itemsFood; } public List<Food.FoodSize> getItemsFoodSize(){ return _itemsFoodSize; } public List<Showing> getItemsShowing(){ return _itemsShowing; } // Set Item Number public int setItemNumber(){ return _itemNumber; }    // Set Items public void addItems(Food item, Food.FoodSize size){ this._itemsFood.add(item); this._itemsFoodSize.add(size); } public void addShowing(Showing showing, int count){ this._itemsShowing.add(showing); _itemNumber = _itemNumber + count; } // remove } * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package model;
import java.util.List; import java.util.ArrayList;
/** * * */ public class Cart {    // Item Number private int _itemNumber; // The items private List<Food> _itemsFood = new ArrayList<Food>(); private List <Food.FoodSize> _itemsFoodSize = new ArrayList<Food.FoodSize>(); private List<Showing> _itemsShowing = new ArrayList<Showing>(); private ArrayList<Payment.paymentType> _getpayment = new ArrayList<Payment.paymentType>();    // Item Number constructor public Cart(int itemNumber){ this._itemNumber = itemNumber; }    // Get Item Number public int getItemNumber(){ return _itemNumber; }    // Get Iteams public List<Food> getItemsFood(){ return _itemsFood; } public List<Food.FoodSize> getItemsFoodSize(){ return _itemsFoodSize; } public List<Showing> getItemsShowing(){ return _itemsShowing; } // Set Item Number public int setItemNumber(){ return _itemNumber; }    // Set Items public void addItems(Food item, Food.FoodSize size){ this._itemsFood.add(item); this._itemsFoodSize.add(size); } public void addShowing(Showing showing, int count){ this._itemsShowing.add(showing); _itemNumber = _itemNumber + count; } // remove }



Carthelper.java


* To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package model;
import model.Food; import model.Cart; import model.FoodHelper; import model.IDataStorage;
/** * * */ public class CartHelper {    private static FakeDataStorage _storeCart = new FakeDataStorage(); private int count = 0; private Cart cart = new Cart(count); public void CartAddFood(Food food, Food.FoodSize size){ cart.addItems(food, size); count ++; }    private void CartAddShowing(Showing showing, int count){ cart.addShowing(showing, count); }       private void checkout(Cart cart, Payment payment){ System.out.println("Total food you are purchasing:" + cart.getItemsFood()); System.out.println("The movie you are purchasing:" + cart.getItemsShowing()); System.out.println("Which payment method are you using?" + payment.getPaymentType()); } } * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package model;
import model.Food; import model.Cart; import model.FoodHelper; import model.IDataStorage;
/** * * */ public class CartHelper {    private static FakeDataStorage _storeCart = new FakeDataStorage(); private int count = 0; private Cart cart = new Cart(count); public void CartAddFood(Food food, Food.FoodSize size){ cart.addItems(food, size); count ++; }    private void CartAddShowing(Showing showing, int count){ cart.addShowing(showing, count); }       private void checkout(Cart cart, Payment payment){ System.out.println("Total food you are purchasing:" + cart.getItemsFood()); System.out.println("The movie you are purchasing:" + cart.getItemsShowing()); System.out.println("Which payment method are you using?" + payment.getPaymentType()); } }

Explanation / Answer

import java.util.List;
import java.util.ArrayList;

/**
*
*
*/
public class Cart {
  
// Item Number
private int _itemNumber;
// The items
private List<Food> _itemsFood = new ArrayList<Food>();
private List <Food.FoodSize> _itemsFoodSize = new ArrayList<Food.FoodSize>();
private List<Showing> _itemsShowing = new ArrayList<Showing>();
private ArrayList<Payment.paymentType> _getpayment = new ArrayList<Payment.paymentType>();
  
// Item Number constructor
public Cart(int itemNumber){
this._itemNumber = itemNumber;
}
  
// Get Item Number
public int getItemNumber(){
return _itemNumber;
}
  
// Get Iteams
public List<Food> getItemsFood(){
return _itemsFood;
}
public List<Food.FoodSize> getItemsFoodSize(){
return _itemsFoodSize;
}
public List<Showing> getItemsShowing(){
return _itemsShowing;
}
// Set Item Number
public int setItemNumber(){
return _itemNumber;
}
  
// Set Items
public void addItems(Food item, Food.FoodSize size){
this._itemsFood.add(item);
this._itemsFoodSize.add(size);
}
public void addShowing(Showing showing, int count){
this._itemsShowing.add(showing);
_itemNumber = _itemNumber + count;
}
// remove
//method to remove
public void removeItems(Food item, Food.FoodSize size){
this._itemsFood.remove(item);
this._itemsFoodSize.remove(size);
}
public void addShowing(Showing showing, int count){
this._itemsShowing.remove(showing);
_itemNumber = _itemNumber - count;
}
  
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote