C++ You operate several hot dog stands distributed throughout town and need to t
ID: 3716709 • Letter: C
Question
C++
You operate several hot dog stands distributed throughout town and need to track sales.
Define a class named HotDogStand
has a member variable for the hot dog stand's ID number and a
has a member variable for how many hot dogs the stand has sold that day.
has a constructor that allows a user of the class to initialize both values.
has a function named "JustSold"
increments the number of hot dogs the stand has sold by one.
(this method will be invoked each time the stand sells a hot dog)
has a function that returns the number of hot dogs sold.
has a static variable called totalDogs that tracks the total number of hotdogs sold by all hot dog stands (should be updated as part of each sale)
has a static function that returns the value of totalDogs
Write a main function that will:
Welcomes
create 3 hotdog stands
initialize the stands to the ids 1,2,3
initialize sales to 0
display the current sales for each stand
display totalDogs
invoke the JustSold function once for each stand
display the current sales for each stand
display totalDogs
Use 3 loops to:
invoke JustSold 123 times for stand 1
invoke JustSold 101 times for stand 2
invoke JustSold 134 times for stand 3
display the current sales for each stand
display totalDogs
Goodbye
Explanation / Answer
Please find my implemntation.
output:
one (1) - 0
two (2) - 0
three (3) - 0
Total: 0
Name ID Number Sold
________________________________
one 1 1
two 2 1
three 3 1
Total: 3
Process finished with exit code 0
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.