create a c++ file with class named bluebox should have member functions admin- a
ID: 3547810 • Letter: C
Question
create a c++ file with class named bluebox
should have member functions
admin- allows the owner of the machine to sign in using code 99. the member function screen should the owner any dvds currently in stock or not renter and those that have been returned. how much money made on sales. assume all revenues as profit.
inventory- track dvd invrntory. 2 copies of 3 different dvds available only. if they request a tile out of inventory must tell em.
screen- should control all output to the screen. including user interface.
customers-should tell which customer is renting. give each customer a name and greet them each time they sign in. there are three customers which gain access using code 00 01 12
returned- control the returned dvds by a customer. these are not restocked.
the whole program should keep running once the code has been entered customers can rent anf return without reentering the code
when there is no dvds in the box program should close down and cout a message out of order
Explanation / Answer
As long as you don't mind some restrictions, this is fairly easy to do. The easiest way to do the job restricts you to classes that descend from one common base class. In this case, you can do something like this:
You'll then obviously need some concrete classes derived from that base:
Then we need some way to create an object of each type:
Finally, we need a map from the names to the factory functions:
That (finally!) gives us enough so we can map from a name to a function object:
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.