Question: 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

 

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!