Your program should input the user\'s name, their age, and today\'s price for a
ID: 3620162 • Letter: Y
Question
Your program should input the user's name, their age, and today's price for a gallon of gas. Make sure to prompt the user for information, such as "please enter your age: ".Once the user has entered this information, print the following to the screen: Welcome age year old user name. Also print out the price of gas, and the price of gas squared. Include text to say what it is you are printing. If the price of gas squared is greater than the person's age, print "Congratulations on getting your driver's license." Otherwise, print "I bet you remember when gas was one dollar per gallon." Helpful hint: to print a single quote character, you need to use two in a row, as below. disp('driver''s licence');
Your program should work for all possible inputs. Make sure that you test it with several different cases. For example, what if the age is given as a floating-point number, like 21.4? What if the user enters 0, -10, or 1000? You can assume that the user will enter numbers for the age and price prompts.
Explanation / Answer
Please rate, name = input('Please enter your name: ', 's'); x = 0; while x==0 age = input('Please enter your age: '); age = floor(age); if (0 age fprintf('Congratulations on getting your driver''s license.'); else fprintf('I bet you remember when gas was one dollar per gallon. '); endRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.