Question: Code Responsibly-- How Can I Properly Validate nput? heck all input: Below is a partial list of some checks to include: . Type check input

 Code Responsibly-- How Can I Properly Validate nput? heck all input:

Below is a partial list of some checks to include: . Type

check input should be checked to ensure it is the datatype expected,

Code Responsibly-- How Can I Properly Validate nput? heck all input: Below is a partial list of some checks to include: . Type check input should be checked to ensure it is the datatype expected, e.g., age must be integer . Length check: variables are checked to ensure they are the appropriate length, for example, a US telephone number has 10 digits. Range check-numbers checked to ensure they are within a range of possible values, for example, the value for month should lie between 1 and 12 Reasonable check: values are checked for their reasonableness, e.g. (age> 16) && (age 100) Divide by Zero: variables are checked for values that might cause problems such as division by zero. .Format check - Checks that the data is in a specified format (template), e.g, dates have to be in the format DD/MM/YYYY Input checking can be difficult. Checking a telephone number may require consideration of the many differing telephone formats used by countries around the world. Recover Appropriately A robust program will respond to invalid input in a manner that is appropriate correct, and secure. When your program runs across invalid input, it should recover as much as possible and then repeat the request, or otherwise continue on. Arbitrary decisions such as truncating or otherwise reformatting data to "make it fit" should be avoided. The following method shows input validation to check range and/or reasonableness: in ValidNum(int min, ?nt max) int value; sin value; while ((value max)) cout

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!