Smoothie Shop Rewards
A Smoothie Shop has a reward card customers can use to pay for their smoothies. In this lab, you will create two Smoothie Cards and order customized smoothies for each customer.
Use the SmoothieCard class in the solution of your program. You can find the code below, but use the documenation to understand how to create Smoothie Cards and use the methods. SmoothieCard Documentation
Reading SmoothieCard Documenation
Open SmoothieCard Documentation and answer the following questions.
- How many constructors does the
SmoothieCardclass have? What data does it require? - List the method signatures for the methods that can be used to customize a smoothie.
- What method can be used to add points to a
SmootieCard? - When you are finished customizing your smoothie, what method should be used to submit the order?
Algorithms and Planning
You will write a program to do the following:
- creates two different
SmoothieCardobjects. - create a smoothie for each customer. You can either obtain input from the user or hardcode the values for the mix-ins and toppings.
- submit the order and report out the order and current point balance.
- modify your code to add points to one of the
SmoothieCardobjects. - display the new balance for this
SmoothieCard.
Before you write your code, determine the initial values for each SmoothieCard as well as each order and what you expect the output to be after you send the orders to be made.
Further Investigation
Answer the following questions, write program code to test what happens.
- After a smoothie order is sent, what are the values for the number of fruit scoops, protein scoops, and list of toppings?
- What happens if you attempt to send a smoothie order without having added any fruit scoops, protein scoops, or list of toppings? What problems might this cause?
Write Your Program
Now that you have planned out your program, it's time to write it in your IDE. You will have two .java files for this program. It is best practice to create a project folder for both of these files to be stored together.
- The first file will be your main program file. You can name it
SmoothieShop.javaand add your algorithm to the body of themainmethod in the starter code provided.
- The second file will be the
SmoothieCard.javafile. Name the file as indicated and the copy the code below directly into the file. This file contains numerous concepts we have yet to learn in this course, so don't be alarmed if you don't understand the Java code written.