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...
-
Oregon Forest Products will acquire new equipment that falls under the five-year MACRS category. The cost is $300,000. If the equipment is purchased, the following earnings before depreciation and...
-
Selected financial information for Dulock Company for 2012 follows. Required Assuming that the merchandise inventory buildup was relatively constant, how many times did the merchandise inventory turn...
-
What do you know about the mathematical value of a project's internal rate of return under each of the following conditions? a. The present worth of the project is greater than 0 . b. The present...
-
Starr Co. had sales revenue of $540,000 in 2012. Other items recorded during the year were: Cost of goods sold $330,000 Salaries and wages expense 120,000 Income tax expense 25,000 Increase in value...
-
In some ways, a qualitative portfolio manager could never really be an index portfolio manager, whereas a quantitative portfolio manager could be. Explain why.
-
SEC regulation, tax and working papers. Marshall and Wyatt, CPA, have been for several years the independent auditors of Interstate LDC Land Development Corporation of New Orleans, Louisiana. During...
-
There are many psychological approaches to addressing social problems (e.g., clinical, developmental, cognitive, phenomenological, neurobiological, and behavioral). The social-psychological approach...
-
Define ethical leadership and discuss how personal morality and leader morality contribute to ethical leadership using examples to illustrate your answer.
-
Describe Ratan Tata's Ethical Leadership under the GLOBE framework. (please give the examples from the case Ratan Tata: Ethical Leadership) ?
-
Why Ethics is central to leadership? discuss the benefits of ethical leadership? Explain how ethical leaders play a vital role in making a company successful? Also please elaborate on ethical...
-
Need an example of ethical leadership in an organization Please provide a proper and detailed example of company or organization with ethical leadership Please except patagonia ! Any another...
-
1.Research values-based and ethical leadership... discusses some guidelines for ethical leadership. 2. Discuss the importance of values and ethics for the pathway in business Management.
-
Find the values of variables x and y. State what theorems did you use to obtain your answers. ( 3x - 5)/ (2x +15) 10
-
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...
-
The group \(\mathrm{D}_{3}\) in Schoenflies notation (32 in international notation, which is read "three-two"; see Table 5.1 ) consists of the proper (those not reflections or inversions) covering...
-
Derive the two-dimensional matrix representation Tic)=(2) Tin)=(3) Tex)=(37) (69) T(c2b)= 1 TO)-(71) 10-(11) TO=(9) = for the group D3, using the basis (e1, e2) defined in the following figure.
-
Prove that the matrix representation of \(\mathrm{D}_{3}\) worked out in Problem 5.6 is irreducible. Data from Problem 5.6 Derive the two-dimensional matrix representation Tic)=(2) Tin)=(3)...
Study smarter with the SolutionInn App