Question
Problem 2B (50 points + 5 bonus) JAVA CODE Implement a program that inputs the diameter of a planet and the area covered by water,
Problem 2B (50 points + 5 bonus) JAVA CODE
Implement a program that inputs the diameter of a planet and the area covered by water, and determines whether the planet is suitable for human settlements; and, if not, whether it is suitable for a research station. Unlike a simpler version in Problem 2A, it should allow inputting information about multiple planets, print the results for each planet, and count the number of planets.
Input and output:
Your program should prompt the user to enter the diameter of the planet and the area covered by water. We assume that the diameter is a real value between 100.0 and 100,000.0 (measured in miles), and the area covered by water is a real value between 0.0 and 30,000,000,000.0 (measured in square miles). The program should then print one of these three statements: The planet is suitable for settlements, The planet is suitable for a research station, or The planet is not suitable for humans. After the program inputs the information about the first planet and outputs the related sentence, it should prompt the user to input information about the second planet, then about the third planet, and so on. When there are no more planets, the user inputs a negative number (e.g. ?1) as the planets diameter, which is the termination signal. Once the program gets a negative diameter, it should print the total number of planets and stop.
Example: Command Prompt Enter diameter of the planet: 8000.0 Enter area covered by water: 100000000.0 The planet is suitable for settlements Enter dianeter of the planet: 1000 Enter area covered by water:0 The planet is suitale for a research station Enter diameter of the planet: 20000 Enter area covered by water: 100000000 The planet is not suitable for hunans Enter dianeter of the planet: 1 The Enterprise has discovered 3 new planetsStep 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