Class SmoothieCard

java.lang.Object
SmoothieCard

public class SmoothieCard extends Object
  • Constructor Details

    • SmoothieCard

      public SmoothieCard(String name, int pts)
      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

      public void addTopping(String type)
      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

      public String 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

      public String getCustomerName()
      Returns the name of the customer.
      Returns:
      the customer's name.
    • 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

      public String getToppings()
      Returns a list of toppings ordered.
      Returns:
      a list of toppings in the order.