Static variables and static method

April 2, 2011 at 14:55:05
Specs: Windows Vista
question 1. You operate several hotdog stands distributed throughout town. Define a class names HotdogStand that has an instance variable for the hotdog stand's ID number and an instance variable for how many hotdogs the stand has sold that day. Create a constructor that allows a user of the class ti initialize both values.

Also create a method named justSold that increments the number of hotdogs the stand has sold by one. The idea is that this method will be invoked each time the stands sell a hotdog so that you can track the total number of hotdogs sold.

Finally , add a static that track the total number of hotdogs sold by all hotdogs stands and a static method that returns the value in this variable.

Write a main method to test your class with atleast three hot dog stands that each sell a variety of hotdogs.


See More: Static variables and static method

Report •


#1
April 2, 2011 at 18:26:17
To get help with homework questions you must make an honest effort to solve the problem yourself, show the code you have, and ask a specific question. If you are unable to do this you should talk to you teacher or tutor.

No one will do your homework for you.


Report •
Related Solutions


Ask Question