Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:
1. 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 (B/U/A/V/E), the binary operators (+,-,*,/,%, P, X, I), the unary operators (S/L/E/C/F),
the memory variables (a/b/c/d/e), submenus (B/U/E), 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.
2. 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 non-numeric. 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.
3. 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 a/b/c/d/e. 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.
4. Finally, make sure to run the program and ensure it does not crash/fail on any given input.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions