Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You ll create both pseudocode and a flowchart to design an application that displays the following menu: Select a Planet 1 . Mercury 2 .

Youll 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\times 10^23kg
Surface temperature 173 to 430 degrees Celsius
Venus Average distance from the sun 108.2 million kilometers
Mass 4.87\times 10^24kg
Surface temperature 472 degrees Celsius
Earth Average distance from the sun 149.6 million kilometers
Mass 5.967\times 10^24kg
Surface temperature 50 to 50 degrees Celsius
Mars Average distance from the sun 227.9 million kilometers
Mass 0.6424\times 10^24kg
Surface temperature 140 to 20 degrees Celsius
Is this correct?
START
//main module
Module main()
//declare a variable to hold the menu selection
DECLARE Integer selection
Do
//Display the menu
Call displayMenu(selection)
//Perform the selected operation
Select selection
Case 1:
DISPLAY "Planet: Mercury
Average distance from sun: 57.9 million kilometers
Mass: 3.31\times 10^23kg
Surface temperature: 173 to 430 degrees Celsius"
Case 2:
DISPLAY "Planet: Venus
Average distance from the sun: 108.2 million kilometers
Mass: 4.87\times 10^24kg
Surface temperature: 472 degrees Celsius
Case 3:
DISPLAY "Planet: Earth
Average distance from the sun: 149.6 million kilometers
Mass: 5.967\times 10^24kg
Surface temperature: 50 to 50 degrees Celsius
Case 4:
DISPLAY "Planet: Mars
Average distance from the sun: 227.9 million kilometers
Mass: 0.6424\times 10^24kg
Surface temperature: 140 to 20 degrees Celsius
Case 5:
Exit the program
End select
While selection !=5
End Module
//The displayMenu module displays the menu, gets and validates the user's selection
Module displayMenu(Integer Ref selection)
//Display the menu.
DISPLAY "Select a planet from the menu & information about the planet will be displayed."
DISPLAY "1. Mercury"
DISPLAY "2. Venus"
DISPLAY "3. Earth"
DISPLAY "4. Mars"
DISPLAY "5. Exit the program"
DISPLAY "Enter your selection."
//Get the user' selection.
INPUT selection
//Validate the selection.
While selection <1 OR selection >5
DISPLAY "That is an invalid selection."
DISPLAY "Enter 1,2,3,4 or 5."
INPUT selection
End While
End Module
EXIT

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

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions