Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java Concepts Late Objects

Authors: Cay S. Horstmann

3rd Edition

1119186714, 978-1119186717

More Books

Students also viewed these Databases questions

Question

the name of the first microcomputer operating system software is

Answered: 1 week ago