discussion-2994

If you have a class called ShoppingCart, List at least three API (method) that helps manage the ShoppingCart.

For example

public class ShoppingCart {
public static void main(String[] args) {

public double getTaxRate() { // Tax rate of 15%
double taxRate;
return taxRate = 0.15;
}

public String addItem(int quantity, double price, double totalPrice) { // Additems to cart
double add;
add = totalPrice + (quantity * price);
return (“Your shopping cart has a total of $” + add);
}

public String clearCart(int quantity, double totalPrice) { // Clears cart of any quantity and sets price to 0
int clearQuantity;
double clearPrice;
clearQuantity = quantity * 0;
clearPrice = totalPrice * 0;
return (“Your shopping cart has been cleared of all items.”);
}

}

Get 15% discount on your first order with us
Use the following coupon
FIRST15

Order Now