Coding Problem Please check my work!
You’ll apply the concepts of Lesson 3 to create a basic menu-driven program.
You’ll create both pseudocode and a flowchart to design an application that displays the following menu:
--------------------------------
Select a Planet
1. Mercury
2. Venus
3. Earth
4. Mars
5. Exit the program
Enter your selection.
----------------------------------
When the user selects a planet from the menu, the program should display the following information about the planet:
Mercury Average distance from the sun 57.9 million kilometers
Mass 3.31 × 10^23kg
Surface temperature –173 to 430 degrees Celsius
Venus Average distance from the sun 108.2 million kilometers
Mass 4.87 × 10^24kg
Surface temperature 472 degrees Celsius
Earth Average distance from the sun 149.6 million kilometers
Mass 5.967 × 10^24kg
Surface temperature –50 to 50 degrees Celsius
Mars Average distance from the sun 227.9 million kilometers
Mass 0.6424 × 10^24kg
Surface temperature –140 to 20 degrees Celsius
(pseudocode) My Code:
Module main()
Declare Interger option
Call menuSelection()
Select option
Case 1:
Call planetMercury()
Case 2:
Call plantetVenus()
Case 3:
Call planetEarth()
Case 4:
Call planetMars()
Case 5:
Call endProgram()
End Select
EndModule
// display the menu slection
Module menuSelection
Display "1. Show information about Mercury."
Display "2. Show information about Venus."
Display "3. Show information about Earth."
Display "4. Show information about Mars."
Display "5. Exit the program."
Display "Enter your selection."
Input menuSelection
End Module
// if Merucury was selected
Module planetMercury()
Display "Mercury's average distance from the sun is: 57.9 million kilometers."
Display "Mercury's mass is: 3.31 x 10^23kg."
Display "Mercury's sufrface tempertaure is: -173 to 430 degrees Celsius
End Module
//If Venus was selected
Module planetVenus()
Display "Venus's average distance from the sun is: 108.2 million kilometers."
Display "Venus's mass is: 4.87 x 10^24kg."
Display "Venus's surface temperature is: 472 degrees Celsius
End Module
// if Earth was seleted
Module planetEarth()
Display "Earth's average distance from the sun is: 149.6 million kilometers."
Display "Earth's mass is: 5.967 x 10^24kg."
Display :Earth's surface temperature is: -50 to 50 degrees Celsius
End Module
//if Mars was selected
Module planetMars()
Display "Mars average distance from the sun is: 227.9 million kilometers."
Display "Mars mass is: 0.6424 x 10^24kg."
Display "Mars surface temperature is: -140 to 20 degrees Celsius."
End Module
// if exit the program was selected
Module endProgram()
Display "The program has ended."
End Module