Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hot Dog Stand Exercise Instructions: Create a complete Java Program that meets the following requirements. You operate several hot dog stands distributed throughout town. Define

Hot Dog Stand Exercise
Instructions: Create a complete Java Program that meets the following requirements.
You operate several hot dog stands distributed throughout town. Define a class named HotDogStand that has an instance variable for (1) the hot dog stand's ID number and an instance variable for (2) 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 hot dogs. This means that the program will create 3 objects of type HotDogStand.
Note: No user input is required in order to complete this exercise.
Sample Run:
[Note: After the first Total sold output statement, Stand 1 and Stand 3 sold 1 more each.]
Stand 1 sold 2
Stand 2 sold 1
Stand 3 sold 0
Total sold =3
Stand 1 sold 3
Stand 2 sold 1
Stand 3 sold 1
Total sold =5
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Select Healthcare Classification Systems And Databases

Authors: Katherine S. Rowell, Ann Cutrell

1st Edition

0615909760, 978-0615909769

More Books

Students also viewed these Databases questions