Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need to create a JUnit test that If I put food Item in the cart and remove it, the cart is empty. public class

I need to create a JUnit test that If I put food Item in the cart and remove it, the cart is empty.

public class Cart { // Item Number private int _itemNumber; // The items private List _itemsFood = new ArrayList(); private List _itemsFoodSize = new ArrayList(); private List _itemsShowing = new ArrayList(); private ArrayList _getpayment = new ArrayList(); public Cart(int itemNumber){ this._itemNumber = itemNumber; } public int getItemNumber(){ return _itemNumber; } public List getItemsFood(){ return _itemsFood; } public List getItemsFoodSize(){ return _itemsFoodSize; } public List getItemsShowing(){ return _itemsShowing; } public int setItemNumber(){ return _itemNumber; } public void addItems(Food item, Food.FoodSize size){ this._itemsFood.add(item); this._itemsFoodSize.add(size); } public void addShowing(Showing showing, int count){ if(showing.getAvailable().isEmpty()) }

this._itemsShowing.add(showing); _itemNumber = _itemNumber + count; } public void removeitem(Showing showing, int count, Food item){ this._itemsShowing.remove(showing); _itemNumber = _itemNumber - count; this._itemsFood.remove(item); } }

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 CartRemove(Showing showing, int count, Food item){ cart.removeitem(showing, count, item); } 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()); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 19th International Conference Dexa 2008 Turin Italy September 2008 Proceedings Lncs 5181

Authors: Sourav S. Bhowmick ,Josef Kung ,Roland Wagner

2008th Edition

3540856536, 978-3540856535

More Books

Students also viewed these Databases questions

Question

What are the challenges associated with tunneling in urban areas?

Answered: 1 week ago

Question

What are the main differences between rigid and flexible pavements?

Answered: 1 week ago

Question

What is the purpose of a retaining wall, and how is it designed?

Answered: 1 week ago

Question

How do you determine the load-bearing capacity of a soil?

Answered: 1 week ago

Question

what is Edward Lemieux effect / Anomeric effect ?

Answered: 1 week ago