Question: In Java MyProgrammingLab You operate several hot dog stands distributed throughout town. Define a class named HotDogStand that has an instance variable for the hot

In Java

MyProgrammingLab

You operate several hot dog stands distributed throughout town. Define a class named HotDogStand that has an instance variable for the hot dog stands ID number and an instance variable for how many hot dogs the stand has sold that day. Create a constructor that allows a user of the class to initialize both values. Also create a method named justSold that increments by one the number of hot dogs the stand has sold. The idea is that this method will be invoked each time the stand sells a hot dog so that you can track the total number of hot dogs sold by the stand. Add another method that returns the number of hot dogs sold. Finally, add a static variable that tracks the total number of hot dogs sold by all hot dog stands and a static method that returns the value in this variable. Write a main method to test your class with at least three hot dog stands that each sell a variety of HotDogs. Your main methodshould asks user to enter command. A command can be "sold", which in result would ask for cart number and increment its pointer. Another command can be "print", which will also asks for cart number and print how many hotdogs that cart sold. One command would be "print-all", that will result in printing how many HotDogs were sold by all carts. Call Static method of HotDogStand for "print-all". Lastly, anything else will terminate the program.

Sample Output

Entercommad:sold

EnterCartNumber:0

Entercommad:sold

EnterCartNumber:1

Entercommad:sold

EnterCartNumber:2

Entercommad:print

EnterCartNumber:0

Cartsold:1Entercommad:print

EnterCartNumber:1

Cartsold:1Entercommad:print

EnterCartNumber:2

Cartsold:1Entercommad:print-all

Totalsold:3Entercommad:exit

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!