Question
Imagine you cultivate and sell roses. You cultivate roses only in 5 colors. (Red, Pink, White, Yellow, Black) You need a menu based program for
Imagine you cultivate and sell roses. You cultivate roses only in 5 colors. (Red, Pink, White, Yellow, Black) You need a menu based program for your shop to track rose commerce. You should be able to do the following operations: - Check current stock information - Update stocks - Update prices - Sell product (with stock control) - Check current cash information Notes : - Initial stocks : Red Rose : 0 Pink Rose : 0 White Rose : 0 Yellow Rose : 0 Black Rose : 0 - Initial prices : Red Rose : 5 TL Pink Rose : 6 TL White Rose : 7 TL Yellow Rose : 8 TL Black Rose : 20 TL Use the following functions : - printMainMenu() Prints main menu (as seen in the sample run) - printStockInformation() Prints stock information (as seen in the sample run) - printProductPrices() Prints product price (as seen in the sample run) - printProducts() Prints product information (as seen in the sample run) - printCashInfo() Prints current cash information (as seen in the sample run) - stockControl() parameters: productStockInfo and numberOfRequested return: if stock is enough return 1, else return 0 - updateStocks() Changes products stocks - updatePrices() Changes products prices - sell() Check the stock, sell products, then update stocks and arrange a bill - calculateBill() Prints productPrice x numberOfRequested = resultant. message. parameters: productPrice and numberOfRequested return: resultant value. - addMoney() Prints Add x TL to cash register. message and update total cash. parameters: resultant from the bill - You can add other functions, but you have to implement all the functions listed above.
Sample Run: (inputs are marked as bold) OPERATIONS : 1. Stock Info 2. Update Stocks 3. Update Prices 4. Sell 5. Current cash info 6. Quit Select your operation : 2 ************************************** Current Stock Information : 1. Red Rose : 0 2. Pink Rose : 0 3. White Rose : 0 4. Yellow Rose : 0 5. Black Rose : 0 ************************************** Select product : 2 Enter stock for Pink Rose product : 55 ************************************** Current Stock Information : 1. Red Rose : 0 2. Pink Rose : 55 3. White Rose : 0 4. Yellow Rose : 0 5. Black Rose : 0 ************************************** OPERATIONS : 1. Continue update stock 2. Return main menu Select your operation : 2
OPERATIONS : 1. Stock Info 2. Update Stocks 3. Update Prices 4. Sell 5. Current cash info 6. Quit Select your operation : 3 ************************************** Prices : 1. Red Rose : 5 TL 2. Pink Rose : 6 TL 3. White Rose : 7 TL 4. Yellow Rose : 8 TL 5. Black Rose : 20 TL ************************************** Select product : 2 Enter new price for Pink Rose product : 3 ************************************** Prices : 1. Red Rose : 5 TL 2. Pink Rose : 3 TL 3. White Rose : 7 TL 4. Yellow Rose : 8 TL 5. Black Rose : 20 TL ************************************** OPERATIONS : 1. Continue update price 2. Return main menu Select your operation : 2 OPERATIONS :
1. Stock Info
2. Update Stocks 3. Update Prices 4. Sell 5. Current cash info 6. Quit Select your operation : 4 ****************************************** Products : 1. Red Rose - 5 TL - (0) 2. Pink Rose - 3 TL - (55) 3. White Rose - 7 TL - (0) 4. Yellow Rose - 8 TL - (0) 5. Black Rose - 20 TL - (0) ******************************************* Select product : 2 Enter how many Pink Rose products are requested : 15 15*3=45. Add 45 TL to cash register. ****************************************** Products : 1. Red Rose - 5 TL - (0) 2. Pink Rose - 3 TL - (40) 3. White Rose - 7 TL - (0) 4. Yellow Rose - 8 TL - (0) 5. Black Rose - 20 TL - (0) ******************************************* OPERATIONS : 1. Continue selling 2. Return main menu Select your operation : 1 ****************************************** Products : 1. Red Rose - 5 TL - (0) 2. Pink Rose - 3 TL - (40) 3. White Rose - 7 TL - (0)
4. Yellow Rose - 8 TL - (0) 5. Black Rose - 20 TL - (0) ******************************************* Select product : 5 Enter how many Black Rose products are requested: 15 SORRY Black Rose product is out of stock. OPERATIONS : 1. Continue selling 2. Return main menu Select your operation : 2 OPERATIONS : 1. Stock Info 2. Update Stocks 3. Update Prices 4. Sell 5. Current cash info 6. Quit Select your operation : 5 ************************************** Current cash information : 45 TL ************************************** OPERATIONS : 1. Stock Info 2. Update Stocks 3. Update Prices 4. Sell 5. Current cash info 6. Quit Select your operation : 6 Bye!
Using Pointer is Forbidden and deadline is midnight.We should do it on C Language.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started