Question: You operate several bakery stands distributed throughout town. Define a class namedBakeryStandthat has a member variable for the bakery stand's ID number and a member
You operate several bakery stands distributed throughout town. Define a class namedBakeryStandthat has a member variable for the bakery stand's ID number and a member variable for how many cupcakes the stand has sold that day. Create a constructor that allows a user of the class to initialize both values. Also create a method namedJustSoldthat increments the number of cupcakes the stand has sold by one.
The idea is that this method will be invoked each time the stand sells a cupcake so that you can track the total number of cupcakes sold by the stand. Add another method that returns the number of cupcakes sold. Finally, add a static variable that tracks the total number of cupcakes sold by all bakery stands and a static method that returns the value in this variable. Write a main method to test your class with at least three bakery stands that each sell a variety of cupcakes.
Add toString() method that will return a String similar to the following: Bakery Stand # 1 has sold 5 cupakes, All stands together sold 9 cupcakes
Step by Step Solution
There are 3 Steps involved in it
Heres the implementation of the BakeryStand class in Java public class BakeryStand private int stand... View full answer
Get step-by-step solutions from verified subject matter experts
