Basic computation and input/output solution


Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment


5/5 - (2 votes)

Basic computation and input/output
You are an amateur astronomer and space travel buff and dream about someday visiting other planets
in the Solar System. The recent discovery of the planet Proxima b about four light‐years away (practically
next door in intergalactic terms), which appears to be a rocky planet with an atmosphere that could
support life as we know it, has given you a new urge to do something. So, you decide to write a
computer program in C that will let a user learn a little about each planet (very little!). The program is to
calculate the surface area of each of the planets in the Solar System and its distance from the Sun. The
program will include the nine planets in the Solar System, including the recently demoted Pluto. So:
Write a program that requests from the user the name of the planet in the Solar System about which
the user wants to learn more. Because you don’t yet know about strings in C, you can input the first
letter of each planet’s name: m for Mercury; v for Venus; e for Earth; a for Mars (m is already taken!); j
for Jupiter; s for Saturn; u for Uranus; n for Neptune; and p for Pluto. The program will print out the
surface area (look up the formula!) of the requested planet (assume they are prefect spheres) in square
miles (not kilometers!), and its distance from the Sun, also in miles.
The planetary data can be found in The important
pieces of information in that webpage are the circumference of each planet and its distance from the
Sun. Note that these values are in Km, so you will have to convert to miles. You can find the conversion
factor also from the Web.
Make the output friendly. It should state the output as follows:
Welcome to the program Learning about Planets!
You have selected to learn about