๐ The system should keep track of stock codes, stock prices, and stock count in three separate lists. The stock codes should be string-based ๐, the prices floating-point ๐ฐ, and the count as integer ๐ข. To keep them competitive, their financial planner has advised them never to carry more than 50 types of stock (according to stock code) at a time ๐ซ๐ฆ.
โ The system needs to have a function called AddStockCode() ๐ท๏ธ.
This function needs to prompt the user for a stock code and price and then add these values to the others already stored in the system ๐๏ธ.
Their advisor has also requested that no item may be priced higher than R 1000.00
๐ To find a specific stock code, a search function is required. Create a function called SearchCode ๐งญ to fulfill this function. The function should receive a single string-based parameter, representing the stock code to search for ๐ก. The function must not do any unnecessary searching ๐. As soon as the search value is found, the search process should halt ๐. Upon a successful search, the function must return the index in the stock code list where the value was found ๐งฎ. If the value was not found, display a relevant message to the command-line and return a suitable value โ.
๐ฅ Once the stock codes and prices have been added, it will be necessary to add stock to the system.
Create a function called AddStockItem ๐งพ which will prompt the user for a stock code and the
number of items to add โ๐ฆ.
This function should make a call to the SearchCode function to find the relevant stock item ๐.
To ensure that stock doesnโt get old in the shop ๐ฐ๏ธ, their financial planner has advised them that they should never have more than 100 items of any stock type (according to stock count) in the shop at a time
๐ From time to time, it will be necessary to check the stock list. Create a function called DisplayStockList ๐ฅ๏ธ which will display every stock code, with its associated price, number of items in stock, and total stock value for each item ๐น. The list should also display the total value of all stock in the system ๐ผ. The list should be displayed with a header in a format similar to the following:
Stock code, In stock, Price,Stock value AAA, 10,50,500 BBB,5,20.00,100 Total,,600
To control the system, Micro Circuits wish to make use of a CLI-based menu with the following options:
- Add Stock Code
- Add Stock Item
- Display Stock List
- Exit
The menu should display continuously until the user decides to exit the program, i.e. after selecting options 1 to 3 and completing the activity the menu should always be re-displayed. The program should only exit when option 4 is selected.