Al Hussein Technical University The Tasks Task One Implement the function int mainMenu(). This function is called from t

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Al Hussein Technical University The Tasks Task One Implement the function int mainMenu(). This function is called from t

Post by answerhappygod »

Al Hussein Technical University The Tasks Task One Implement The Function Int Mainmenu This Function Is Called From T 1
Al Hussein Technical University The Tasks Task One Implement The Function Int Mainmenu This Function Is Called From T 1 (103.91 KiB) Viewed 46 times
Al Hussein Technical University The Tasks Task One Implement the function int mainMenu(). This function is called from the main function. It should print out the main menu of the program, it looks like figure I below. Welcome! Please choose one of the following options: 1. Find Nearest Shop. 2. List products cheaper than a price. 3. Add a new product to the store. 4. Process a Purchase. 5. Draw a figure of the prices. 6. Exit. Figure 1 It then accepts the user's choice, which is an integer from 1 to 6. Depending on the choice of the user, it should call the appropriate function and pass any values it needs to it. The following choices should run the following functions and do the following actions before and after running the functions. Function To Call After Calling It Choice 1 Before Calling It Do nothing double findNearestShop() Print the value returned from the function Do nothing 2 void listProductsCheaper Than(double price) Ask the user to inputa price and pass it to the function as an argument Ask the user to input an int addProduct(int sku, double price) SKU and a price for the new product and pass them to the function as arguments If the product was added successfully. print a success message. If the product was not added successfully. print an error message Al Hussein Tedical University Do nothing void processPurchase(int numOfitems, int itemSkus[]) 3 Ask the user to input the number of items the user is going to buy, and then the SKUs of these items Pass the number of items and the array of SKUs to the function as arguments Ask the user to input the number of products they want to draw the prices for, and then the SKUs of these products. Pass the number of products, and the array of SKUs to the function as arguments void drawPrices(int numOfProducts, int productSkus[]) Do nothing After each choice from 1 to 5, mainMenu should return 0 to the main function. If the user chooses 6 (Exit) the function should return 1 to the main function so it could exit. Any other choice should print "Invalid Choice" and return 0. Check the implementation for the main function if you need to. Page 8 of 15 HTU. جامعة الحسين التقنية
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply