Problem 4.2 Ask the user to enter his/her age, with the prompt: How old are you?...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 <whatever the user entered years old. Is that correct? Yes or No ->". If the user enters "y" or "yes", display "This confirms that you are <whatever the user entered> 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. 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 <whatever the user entered years old. Is that correct? Yes or No ->". If the user enters "y" or "yes", display "This confirms that you are <whatever the user entered> 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.
Expert Answer:
Answer rating: 100% (QA)
Answer MATLAB script Sample Output MATLAB Script in text Clear the command wndow wo... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these mechanical engineering questions
-
A random-number generator selects a real number between 0 and 50, inclusive, according to the probability distribution at right. Find each value described. a. α b. P(a number is less...
-
One Direction * * Ask the user to enter integers. As long as the numbers are * all increasing (or equal) or decreasing (or equal), let them * keep entering numbers. As soon as a number is entered...
-
Write a program that will ask the user to enter the amount of a purchase. The program should then compute the state and county sales tax. Assume the state sales tax is 4 percent and the county sales...
-
The file CigaretteTax contains the state cigarette tax ($) for each state as of January 1, 2013. a. Construct an ordered array. b. Plot a percentage histogram. c. What conclusions can you reach about...
-
Vista Supply Company received a 30-day, 4% Note for $90,000, dated September 8 from a customer on account. a. Determine the due date of the note. b. Determine the maturity value of the note. c....
-
Explain how data mining, real-time profiling, collaborative filtering, and outgoing e-mail help firms customize offerings.
-
Sick and tired of the investment banking grind, you decide to quit and buy a franchise for a fast-growing bagel chain in your town. You have been able to get information on what another franchise for...
-
The trial balance for Terrys Auto Shop as of January 1, 2016, follows: The following events affected the company during the 2016 accounting period: 1. Purchased merchandise on account that cost...
-
rounding to the nearest cent. Tks A loan of 390,000 is going to be repaid by month-end repayments of 4,000 starting in one month. The interest rate is 6.7% p.a. compounded monthly. Calculate the loan...
-
Which series has the highest beta. BraveNewCoin Liquid Index for Bitcoin 1D BNC Trading Brave Ne Yellow Green Blue Orange
-
Glassons has $1,250 in total earnings with 750 shares outstanding at a market price per share of $42. Country Road has $740 in total earnings with 220 shares outstanding at $18 per share. Assume...
-
Why might an organization maintain more than necessary amounts of cash, accounts receivable, and inventory? Why might another organization maintain the minimum amount of cash, accounts receivable,...
-
A company that produces cell phones has a cost function of C=22x-418x + 10953, where C is the cost in dollars and x is the number of cell phones produced (in thousands). How many units of cell phone...
-
Macy Corporation's relevant range of activity is 8,100 units to 16,500 units. When it produces and sells 12,300 units, its average costs per unit are as follows: Average Cost per Unit Direct...
-
Banking email marketing helps you personalize customer experiences based on customer preferences and data and interaction with the financial services provider, Explain the Email Marketing Strategies...
-
in Java, Can we rewrite code from powerMock to Mokito only for the Test Case? If yes, How to do it? Let do the code below OjectMapper mockMapper = mock(OjectMapper.class);...
-
PROBLEM 1 . The 2 0 1 4 T 6 aluminum alloy beam in the figure carries a uniformly distributed load of w = 1 0 0 k ( N ) / ( m ) . Calculate the deflection and slope of free end C by using...
-
5. Convert the following ERD to a relational model. SEATING RTABLE Seating ID Nbr of Guests Start TimeDate End TimeDate RTable Nbr RTable Nbr of Seats RTable Rating Uses EMPLOYEE Employee ID Emp...
-
Olive Corporation was formed and began operations on January 1, 2012. The corporation's income statement for the year and the balance sheet at year-end are presented below. The corporation made...
-
In the 2012 tax year, Michelle paid the following amounts relating to her 2010 tax return: Tax deficiency..........................................$5,000 Negligence...
-
Carl Conch and Mary Duval are married and file a joint return. They live at 1234 Mallory Sq. Apt. 64, Key West, FL 33040. Carl works for the Key Lime Pie Company and Mary is a homemaker after losing...
-
What is an example of an inexpensive loan, a medium-priced loan, and an expensive loan?
-
Banks offer many savings options to teenagers. A teen can open a savings/passbook account or a CD (certificate of deposit).
-
How might you select a card that best meets your needs?
Study smarter with the SolutionInn App