java, please work of given code and not rewrite Task is to create a method public void
Fantastic news! We've Found the answer you've been seeking!
Question:
java, please work of given code and not rewrite
Task is to create a method public void viewCart() for the Cart class that prints out the products in the cart in clear way using
public class Cart {
BagInterface Cart;
public Cart() {
cart = new Bag<>(); }
public Cart(Product[] products) {
cart = new Bag<>();
// constructor
for(int i = 0; i
cart.add(products[i]); //addds to cart
}
}
}
for example
Product[] products = {
new Product("taco"3.25),
new Product("taco"3.25),
new Product("taco", 3.25),
new Product("burrito", 9.50)
};
Prints
3x taco 3.25 each
1x burrito 9.50 each
total cost: $19.25
Related Book For
Systems analysis and design
ISBN: 978-0136089162
8th Edition
Authors: kenneth e. kendall, julie e. kendall
Posted Date: