Exercises

1.Suppose that the store using our inventory control program adds a new pharmacy department. Most of their items are nonprescription medications that can be handled with the DatedStockItem class we already created, but their prescription drug items need to be handled more carefully. This means that the member function DeductSaleFromInventory has to ask for a password before allowing the sale to take place. Create a new DrugStockItem class that enforces this new rule without using inheritance.
2.The store also needs some way to keep track of its employees' hours so it can calculate their pay. We'll assume that the employees are paid their gross wages, ignoring taxes. These wages are calculated as follows:
  1. Managers are paid a flat amount ...

Get C++: A Dialog Programming with the C++ Standard Library now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.