You are to simulate an inventory system. A class product holds id, name, price and quantity as its belonging. ID is a fix value by default, say 0, and should increase by one every time there’s a new product been instantiated. Write a proper object class with its constructors, accessors and mutators.
The following methods are needed:
1. addStock method:
This method is to add up the stock in hand. This method should receive an argument of the amount needed to add. Do a checking on the amount given. Perform the update on the current stock only if the amount is greater than zero. Return true if adding the stock is successful or false otherwise.
2. deleteStock method:
This method is to deduct the stock in hand. This method should receive an argument of the amount needed to deduct. Do a checking on the amount given. Deduct from current stock only if the amount is less than the stock, and the stock after deduction should not be less than 15. Return true if purchase is successful or false otherwise.
In your main application, named <your_id>, create an array that holds the products data. Also, include a menu-page of your program should contain these options:
1 – Enter new product
2 – Display all products
3 – Update product
0 – Exit
To make the whole program complete, include the proper exceptions, decimal places to wherever appropriate. Add your own creativity to the system but do not change the basic requirements.