Question: please help with this java programming assignment... it's due at 11:30pm tonight thanks WNI public class GroceryCart { private static final int DEFAULT CAPACITY =
please help with this java programming assignment... it's due at 11:30pm tonight thanks


WNI public class GroceryCart { private static final int DEFAULT CAPACITY = 10; 50 /* 6 * Default constructor with zero arguments. This constructs a grocery * cart with a default capacity of ten items. */ public GroceryCart ( ) { 10 11 12 130 /* 14 * Alternate constructor which takes in a maxCapacity. This maxCapacity 15 * determines how many items can fit inside of this groceryCart. 16 */ 170 public GroceryCart (int maxCapacity) {| 18 19 20 210 /* 22 * Adds an item to the grocery cart. Returns true if the item was added 23 * successfully (i.e. there was still room in the cart to add it. 24 * / 250 public boolean addItem(String item, Double cost) { 26 LP return false; 27 28290 30 * Removes the specified item from the cart. Returns true if the item was 31 * successfully removed (i.e. the item existed in the cart). 32 */ 330 public boolean removeItem(String item) { 34 return false; 35 36 370 /* 38 * Empties the cart of all contents. 39 * / 400 public void emptyCart( ) { 41 42 43 440 * 45 * Returns a string representation of the carts contents. The contents 46 * should be printed out in alphabetical order. It should be of 47 * the form, "item:price, item:price, item:price". An example: 48 * "Green Beans: 2.99, Milk: 41.99, Rolled Oats:1. 99, Zucchini: 2.67" 49 * / 500 public String toString() { 51 return "": 52 53 54 } 55
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
