Question: Task 1 Write overloaded functions named inputVal() that prompt the user for a floating-point number and validate it using the valid ranges given in the

Task 1

Write overloaded functions named inputVal() that prompt the user for a floating-point number and validate it using the valid ranges given in the parameter set.

Use the following function prototypes:

double inputVal(string min, double max);

o Parameters:

string min: the actual string does not matter, indicates no lower limit

double max: upper limit

o Return value: validated user input

double inputVal(double min, string max);

o Parameters:

double min: lower limit

string max: the actual string does not matter, indicates no upper limit

o Return value: validated user input

double inputVal(double min, double max);

o Parameters: string min: lower limit

double max: upper limit

o Return value: validated user input

Consider the following code, which calls these functions:

double solidtemp = inputVal("none", 32.0); // solidtemp

double liquidtemp = inputVal(32.0, 212.0); // 32

double gastemp = inputVal(212.0, "none"); // 212

Write a program named inputvalidation.cpp that:

Tests the three functions

Contains a sample execution of the program in the source code using a multi-line comment (include invalid user inputs)

Task 1 Write overloaded functions named inputVal() that prompt the user for

Task 1 Sample Output Please enter a number (min: no limit, max: 32) 100 Invalid input, try again! Please enter a number (min: no limit, max: 32) -123123 Please enter a number (min 32, max: 212): 0 Invalid input, try again! Please enter a number (min: 32, max: 212) 300 Invalid input, try again! Please enter a number (min 32, max: 212) 100 Please enter a number (min: 212, max: no limit) 100 Invalid input, try again! Please enter a number (min: 212, max: no limit) -100 Invalid input, try again! Please enter a number (min: 212, max: no limit) 212

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!