4.4k views
3 votes
Attempting to write a pseudocode and flowchart for a program that displays 1) Distance from sun. 2) Mass., and surface temp. of Mercury, Venus, Earth and Mars, depending on user selection. Not in any formal programming language, just pseudocode please.

User SlimDeluxe
by
8.3k points

1 Answer

4 votes

Pseudocode:

Display "Select a planet from the following options: Mercury, Venus, Earth, Mars"

Input planetSelection

if planetSelection is equal to "Mercury" then

Display "Distance from sun: 57.91 million km"

Display "Mass: 0.330 x 10^24 kg"

Display "Surface temperature: 430°C"

else if planetSelection is equal to "Venus" then

Display "Distance from sun: 108.2 million km"

Display "Mass: 4.87 x 10^24 kg"

Display "Surface temperature: 462°C"

else if planetSelection is equal to "Earth" then

Display "Distance from sun: 149.6 million km"

Display "Mass: 5.97 x 10^24 kg"

Display "Surface temperature: 15°C"

else if planetSelection is equal to "Mars" then

Display "Distance from sun: 227.9 million km"

Display "Mass: 0.642 x 10^24 kg"

Display "Surface temperature: -63°C"

else

Display "Invalid input, please enter a valid planet name"

end if

Flowchart:

Start -> Display "Select a planet from the following options: Mercury, Venus, Earth, Mars" -> Input planetSelection ->

if planetSelection is equal to "Mercury" then -> Display "Distance from sun: 57.91 million km" -> Display "Mass: 0.330 x 10^24 kg" ->

Display "Surface temperature: 430°C" -> End

else if planetSelection is equal to "Venus" then -> Display "Distance from sun: 108.2 million km" ->

Display "Mass: 4.87 x 10^24 kg" -> Display "Surface temperature: 462°C" -> End

else if planetSelection is equal to "Earth" then -> Display "Distance from sun: 149.6 million km" ->

Display "Mass: 5.97 x 10^24 kg" -> Display "Surface temperature: 15°C" -> End

else if planetSelection is equal to "Mars" then -> Display "Distance from sun: 227.9 million km" ->

Display "Mass: 0.642 x 10^24 kg" -> Display "Surface temperature: -63°C" -> End

else -> Display "Invalid input, please enter a valid planet name" -> End

User Thelonglqd
by
9.4k points