In-Class Practice

Input Validation

Design and code a function named getDouble() that receives two double values - a lower limit and an upper limit - and returns a double value that the user has input and that lies between the limiting values.  Your function rejects any input that lies outside the specified limits.

 double getDouble(double min, double max)


As a challenge exercise, upgrade your solution to reject any input that contains trailing characters.

   Printer Friendly Version of this Page print this page     Top  Go Back to the Top of this Page

  Designed by Chris Szalwinski   Copying From This Site   

Creative Commons License