Columbus State Length of A Year on Another Planet Flowgorithm Lab Project

User Generated

waj1027

Programming

Columbus State Community College

Description

Lab 1 – Calculate the Length of a Year on Another Planet

Background

On a planet in our solar system, a ‘year’ is the amount of time it takes for the planet to revolve around the Sun. The Earth revolves around the Sun in one Earth year. Other planets take shorter or longer periods to revolve around the Sun.

We can use a simple formula (based on Kepler’s Third Law) to calculate the length of a year on another planet in Earth years.

pyears = sqrt(distance ^ 3)

where:

pyears: number of Earth years for the planet to revolve around the Sun

distance: distance of planet from Sun in Astronomical Units (AU’s)

Note: the Earth is exactly one AU from the Sun.

Assignment

Write a program that asks the user for the name of a planet and the distance of that planet from the Sun in AU’s. The program should than calculate a ‘year’ on that planet in Earth years and output the information to the user. Use user friendly prompts. Be sure to include a comment at the beginning of the program with your name, date, and a short description of the program.

Example Output

Additional Information

Here’s some information about the solar system to help test your program.

Planet

Distance (in AU)

Period of Revolution (i.e. ‘year’)

Mercury

0.39

Venus

0.723

Earth

1.0

1.0

Mars

1.524

1.88

Jupiter

5.203

11.86

Saturn

9.539

Uranus

19.18

Neptune

30.06

User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

Hiplease receive...


Anonymous
Super useful! Studypool never disappoints.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4