Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 2B (50 points + 5 bonus) Programing in C not C++ Implement a program that inputs the diameter of a planet and the area

Problem 2B (50 points + 5 bonus) Programing in C not C++

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.

OUTPUT

image text in transcribed

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 planets

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_2

Step: 3

blur-text-image_3

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

1 2 3 Data Base Techniques

Authors: Dick Andersen

1st Edition

0880223464, 978-0880223461

More Books

Students also viewed these Databases questions

Question

LO 11-3 Summarize the five steps in human resource planning.

Answered: 1 week ago

Question

1. Describe the factors that lead to productive conflict

Answered: 1 week ago