Question: n your program, it is expected that any input the user provides will be validated by the program. It is expected that your program does
n your program, it is expected that any input the user provides will be validated by the program. It is
expected that your program does not crash for any given user input and provides either the proper output for
valid inputs, or an error message with a request to recollect the users input for the failed entry. Error
messages and the request for a new input should occur the moment the user has provided the invalid input.
Below are some input validations your program should handle:
For any character that must be read by the program, it must validate that the character given is one
of the available options. Each section has a different set of characters that must be validated: the
main menu BUAVE the binary operators P X I the unary operators SLECF
the memory variables abcde submenus BUE etc. If an invalid character is detected, the
program must print an appropriate error message and request a new character. This is repeated in a
loop until success.
Any time the user is expected to give a floating point value the program should handle the case
where they might insert a character by accident or something nonnumeric. In other words, if the
program fails to read a floating point value, then it should display an appropriate error message and
request the number again until one is read in This is repeated within a loop until success.
In option A the user is allowed to provide a mix of variables or numbers for their calculations. This
means the input could potentially be a character or a number. Your program must be able to
automatically detect whether the input is a number or a character, you should not request the user
to specify which one theyll provide. For example, the program can first check if the input is a
number. On failure it will then try to read a character and validate that it is one of abcde On
failure again, the program should display an error message and request a new input, otherwise use
the number or character read in successfully. The process loops until it successfully reads a number
or valid character. HINT: scanf can return the number of inputs successfully read.
Finally, make sure to run the program and ensure it does not crashfail on any given input.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
