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...
-
Draw an E-R diagram for the ordering system in Figure ORDER ORDER | ORDER | CUSTOMER NUMBER | DATE | NUMBER The ORDER-ITEM ORDER-ITEM ORDER | ITEM I QUANTITY NUMBER |NUMBER ORDERED TEM MASTER ITEM 1...
-
Apple, as well as thousands of other North American companies, are moving their manufacturing operations overseas resulting in a direct loss of more than 20,000 jobs in the US alone and this loss is...
-
How far in advance of trial must a motion for summary judgment be filed?
-
Suppose you know that a companys stock currently sells for $75 per share and the required return on the stock is 11 percent. You also know that the total return on the stock is evenly dividends...
-
Whether in your life as a student or as a professional in the workplace, your life is filled with learning opportunities. With the material we've covered in the last five weeks in mind propose a...
-
The majority of forensic accounting practice involves the valuation of some type of damages or value of a business. Economic damages are a salient service provided by forensic accountants. Lost...
-
Your brother-in-law invests in the stock market and doubles his money in a single year while the market, on average, earned a return of only about 15%, here a discussion is done whether your...
-
Black Bird Corp. is a US firm that is considering investing in a subsidiary in Canada. The subsidiary will generate 45M CAD per year forever. The spot exchange rate is 1.1 CAD/$. The current...
-
In a fit of anger over her last quiz grade, a physics student throws her cell phone straight down off the top of a tall bridge at 5.00 m/s. She regretfully watches it hit the water below 2.50 s after...
-
"Enhancing Project Management-Employer-Employee Relations through Transformational Leadership": How do transformational leadership practices influence employer-employee relations in project...
-
EXPLAIN Why this is IMPORTANT for Network Troubleshooting Wireless Network Design - Wireless Concepts and Standards- Wireless Configuration
-
Define resilience. How can the concept of resilience be applied to the environment, community, and the economy? How are environmental, community, and economic resilience intertwined? Explain at least...
-
You are a preschool director of a prestigious school, with a long waiting list. You are fortunate because a wealthy benefactor donates a lot of money to your school each year; allowing you to always...
-
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...
-
How reliable is the model in Task 6? Task 6 An HIV researcher explored the factors that influenced condom use with a new partner (relationship less than 1 month old). The outcome measure was whether...
-
An HIV researcher explored the factors that influenced condom use with a new partner (relationship less than 1 month old). The outcome measure was whether a condom was used (use: condom used = 1, not...
-
A female who used a condom in her previous encounter scores 2 on all variables except perceived risk (for which she scores 6). Use the model in Task 6 to estimate the probability that she will use a...
Study smarter with the SolutionInn App