Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program that asks the user some questions in order to determine if it is safe for them to ride on the rollercoaster.
Write a program that asks the user some questions in order to determine if it is safe for them to ride on the rollercoaster. It is unsafe for people under 110 cm tall and for pregnant women. The program has to ask for the user's height and gender. If they are female, then they are asked if they are pregnant. The program then outputs whether they are allowed to ride the rollercoaster or not. An appropriate error message should be displayed if any negative number is entered as input. The program should continue until user enters "Quit" as input Example Runs Run1 Last Name? Smith Height (cm)? 120 Gender(Male/Female)? Male You are allowed to ride. Run2 Last Name? Smith Height (cm)?100 You are not allowed to ride. Run4 Last Name? Rose Height (cm)? 160 Gender(Male/Female)a? Female Pregnant(Yes/No)? Yes You are not allowed to ride. Run5 Last Name? Smith Height (cm)?-110 ERROR! Enter correct height. Runs Run3 Last Name? Rose Height (cm)? 130 Gender(Male/Female)? Female Pregnant (Yes/No)? No You are allowed to ride. Last Name? Quit Bye, bye!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started