Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need help with C++ program. Make the program provide the same output as the expected output below. void readInt(string prompt, int &num) (****new for this
Need help with C++ program. Make the program provide the same output as the expected output below.
void readInt(string prompt, int &num) (****new for this level****) 1. This function should be used any time you read any integers from the user. Use this function to read the menu option from the user. 2. It takes a string prompt, outputs it, reads a number from the user, validates and returns the num by reference. 3. See Samplea01.cpp for the function. You may use the function in the sample. 4. You must catch all invalid data such as characters, negative numbers etc. void readDouble (string prompt, double &num) (****new for this level****) This function should be used any time you read any floats or doubles from the user. Use this function to read the cost of the item, tip, etc from the user. 1. 2. It takes a string prompt, outputs it, reads a number from the user, validates and returns the num by reference. 3. Write it exactly like the readint but declare a double or float instead of an int. 4. You must catch all invalid data such as characters, negative numbers etc. void placeOrder (double &cost) 1. Call this function if the user selects 1 from the menu. 2. This function will go through a loop and ask the user to enter item names and their cost until the user answers 'n' to the question - Do you want another item? (y/n): You must validate to make sure the user enters y/n for this question (it should not be case sensitive - must accept both uppercase and lowercase). Use a while loop to do this. 3. The total cost must be returned through the reference parameter and be printed in main(). 4. Call the readDouble function to do this. You must catch all invalid data such as characters, negative numbers etc. 5. Do not print anything in this function. The tip, discount, and final total must be printed in main ().
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