Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mastering Big Data Interview 751 Comprehensive Questions And Expert Answers

Authors: Mr Bhanu Pratap Mahato

1st Edition

B0CLNT3NVD, 979-8865047216

More Books

Students also viewed these Databases questions

Question

What are the purpose and importance of a procedures manual?

Answered: 1 week ago

Question

Understand data problems en- countered in estimating cost functions

Answered: 1 week ago

Question

Writing a Strong Introduction

Answered: 1 week ago