Question: Problem 4.2 Ask the user to enter his/her age, with the prompt: How old are you? Please enter your age as a number between

Problem 4.2 Ask the user to enter his/her age, with the prompt: "How old are you? Please enter your age as a number between 0 and 120. -> ". Check that what was entered is a number between 0 and 120. If anything other than a number between 0 and 120 was entered, display on the screen "This is not a valid human age!" and then prompt the user to enter his/her age again, until a number between 0 and 120 is entered. After that, ask the user to input a string using a prompt: "You just told me that you are ". If the user enters "y" or "yes", display "This confirms that you are years old!" If the user enters "n" or "no", display "OK, there was a mistake, so I'll ask you again. Please enter your age as num ->" and have the user enter his/her age again. Hint: use strcmp command to compare strings, as well as logical operations and (&&) and or (I). Also, please remember how a while loop can be used.
Step by Step Solution
3.44 Rating (154 Votes )
There are 3 Steps involved in it
Answer MATLAB script Sample Output MATLAB Script in text Clear the command wndow wo... View full answer
Get step-by-step solutions from verified subject matter experts
