Question
Write a Java program to do the following: We need to print out with a System.out.println() statement which roller coaster a person can ride. Here
Write a Java program to do the following:
We need to print out with a System.out.println() statement which roller coaster a person can ride. Here are the requirements:
The program is to ask the user to input an age and a weight (in pounds) for the person about to ride the roller coaster. Extra credit if you do sophisticated error checking, like checking for negative numbers, or input that's not a number.
If a person is younger than or equal to 10 years old and weights less than 80 pounds print the following: This person needs to ride the black roller coaster. If a person is younger than or equal to 10 years old and weights between 80 and 200 pounds (including weighing exactly 80 or 200 pounds), print the following: This person needs to ride the green roller coaster. If a person is younger than or equal to 10 years old and weights more than 200 pounds, print the following: This person needs to ride the yellow roller coaster. If a person is younger than or equal to 20 years old but older than 10 and weights less than 80 pounds, print the following: This person needs to ride the silver roller coaster. If a person is younger than or equal to 20 years old but older than 10 and weights between 80 and 200 pounds (including weighting exactly 80 or 200 pounds), print This person needs to ride the red roller coaster. if a person is younger than or equal to 20 years old but older than 10 and weights more than 200 pounds, print: This person needs to ride the purple roller coaster. Everyone else rides the pink roller coaster, print: This person needs to ride the pink roller coaster.
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