Class SmoothieCard
java.lang.Object
SmoothieCard
-
Constructor Summary
ConstructorsConstructorDescriptionSmoothieCard(String name, int pts) Creates a SmoothieCard object with customerName being name, points being pts. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFruit(int count) A number of scoops of fruit are added to the smoothie.voidA scoop of protein is added to the smoothie.voidaddTopping(String type) A topping is added to the smoothie.voidearnBonusPoints(int bonusPoints) A number of points is added to the total number of points on the account.Returns the name of the customer.intReturns the number of fruit scoops ordered.intReturns the number of points remaining.intReturns the number of protein scoops ordered.Returns a list of toppings ordered.The smoothie order is sent to the restaurant to be made.
-
Constructor Details
-
SmoothieCard
Creates a SmoothieCard object with customerName being name, points being pts. Precondition: pts will be > 0. Postcondition: initial add in counts (fruitCount and proteinCount) are all set to 0, toppings is an ArrayList is used to track the toppings added and is empty at the start, pointsUsed is initialized to 0.
-
-
Method Details
-
addFruit
public void addFruit(int count) A number of scoops of fruit are added to the smoothie. Each scoop of fruit cost 75 points. Precondition: count > 0 Postcondition: fruitCount, pointsUsed and points are updated accordingly. -
addProtein
public void addProtein()A scoop of protein is added to the smoothie. Each scoop of protein cost 125 points. Postcondition: proteinCount, pointsUsed and points are updated accordingly. -
addTopping
A topping is added to the smoothie. Each topping cost 50 points. Postcondition: type is added to the list of toppings; pointsUsed and points are updated accordingly. -
earnBonusPoints
public void earnBonusPoints(int bonusPoints) A number of points is added to the total number of points on the account. Points can be added by purchasing a smoothie or purchasing points. Precondition: bonusPoints > 0 -
sendOrder
The smoothie order is sent to the restaurant to be made. The order includes the customers name, amount of fruit and protein to include, and list of toppings. It reports the number of points used and the total remaining points on the account. The customer earns 50 points for ordering a smoothie. The fruit count, protein count, points used for this order and list of toppings are reset.- Returns:
- A string listing the customer's name, order, points used, and points balance.
-
getCustomerName
-
getPointsBalance
public int getPointsBalance()Returns the number of points remaining.- Returns:
- the point balance.
-
getFruitScoops
public int getFruitScoops()Returns the number of fruit scoops ordered.- Returns:
- the number of fruit scoops in the order.
-
getProteinScoops
public int getProteinScoops()Returns the number of protein scoops ordered.- Returns:
- the number of protein scoops in the order.
-
getToppings
Returns a list of toppings ordered.- Returns:
- a list of toppings in the order.
-