Answered step by step
Verified Expert Solution
Question
1 Approved Answer
P5.13 Write a function double read double(string prompt) that displays the prompt string, followed by a space, reads a floating-point number in, and returns it.
P5.13 Write a function double read double(string prompt) that displays the prompt string, followed by a space, reads a floating-point number in, and returns it. Here is a typical usage: salary = read_double("Please enter your salary:"); perc_raise = read_double("What percentage raise would you like?"); Requirements: Please work on P5.13 on page 239. If the input value is invalid, prompt the user to re-enter. Output - your program should print the (new salary) based on the total amount of the raise and original salary. Test Cases: Please use the following test cases to test your program. Case 1: Salary: -$50,000 (Your program should generate an error message and stop processing) Percentage raise: 20% (.20) Message: "Do you want to continue (v)?" Case 2: Salary: $50,000 Percentage raise: - 20% (-.20) (Your program should generate an error message and stop processing) Message: "Do you want to continue (y)?" Case 3: Salary: $50,000 Percentage raise: 20% (20) Message: "Do you want to continue (y)?" Case 4:n send a message: "Exit!" Due date: January 31, 2022 Submission includes 1) The cover page 2) The source listing 3) A screen shot of program execution. Thanks
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