Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

An astronomy application displays information about the eight planets in our sol

ID: 3605582 • Letter: A

Question


An astronomy application displays information about the eight planets in our solar system. Write the logic for this application in pseudocode: a. Visit this web page: https://sciencing.com/order-planets-distance-sun- 8371065.html “Note I made a list from closest to farthest, so you didn’t have to visit website” Mercury = 36 million miles from sun, Diameter = 3031 miles Venus= 67.2 million miles from the sun, Diameter =7,521 miles. Earth = 93 million miles away from the sun, Diameter = 7,926 miles Mars = 483.6 million miles away from the sun, Diameter = 4,222 miles Jupiter = 483.6 million miles away from the sun, Diameter = 88,729 miles Saturn = 886.7 million miles away from the sun, Diameter =74,600 miles Uranus = 1,784.0 million miles away from the sun, diameter = 32,600 miles Neptune = farthest planet from the sun at 2,794.4 million miles, Diameter = 30,200 miles
b. Note down each planet’s name, distance from the sun, and diameter
c. Write the program such that it: i. Displays a numbered list of the planets that includes 1. Planet number (1 is the planet closest to the sun and 8 is the one farthest from it) 2. Planet’s name 3. Distance from the sun 4. Diameter Here is a sample of the required format of output: Planet #1: Mercury is 36 million miles from the sun and has a diameter of 3031 miles
ii. Allows the user to enter the number of any planet, and displays output similar to that shown above, for that planet, e.g., if the user entered 1, the output would be the sentence shown above. If the user enters an invalid planet number, such as zero or 9, the program must display an error message.
iii. Allows the user to enter the numbers of any two planets, and outputs both their names as well as their distance from each other. If the user enters an invalid planet number, such as zero or 9, the program must display an error message.
Note: (ii) and (iii) above must be accomplished without any search being performed An astronomy application displays information about the eight planets in our solar system. Write the logic for this application in pseudocode: a. Visit this web page: https://sciencing.com/order-planets-distance-sun- 8371065.html “Note I made a list from closest to farthest, so you didn’t have to visit website” Mercury = 36 million miles from sun, Diameter = 3031 miles Venus= 67.2 million miles from the sun, Diameter =7,521 miles. Earth = 93 million miles away from the sun, Diameter = 7,926 miles Mars = 483.6 million miles away from the sun, Diameter = 4,222 miles Jupiter = 483.6 million miles away from the sun, Diameter = 88,729 miles Saturn = 886.7 million miles away from the sun, Diameter =74,600 miles Uranus = 1,784.0 million miles away from the sun, diameter = 32,600 miles Neptune = farthest planet from the sun at 2,794.4 million miles, Diameter = 30,200 miles
b. Note down each planet’s name, distance from the sun, and diameter
c. Write the program such that it: i. Displays a numbered list of the planets that includes 1. Planet number (1 is the planet closest to the sun and 8 is the one farthest from it) 2. Planet’s name 3. Distance from the sun 4. Diameter Here is a sample of the required format of output: Planet #1: Mercury is 36 million miles from the sun and has a diameter of 3031 miles
ii. Allows the user to enter the number of any planet, and displays output similar to that shown above, for that planet, e.g., if the user entered 1, the output would be the sentence shown above. If the user enters an invalid planet number, such as zero or 9, the program must display an error message.
iii. Allows the user to enter the numbers of any two planets, and outputs both their names as well as their distance from each other. If the user enters an invalid planet number, such as zero or 9, the program must display an error message.
Note: (ii) and (iii) above must be accomplished without any search being performed
Here are some examples of this chapter



Here is example of another person but I didn’t see step iii and looks like some was in Java.

Chapter 6 ExamplespdTX + 1 of 7 Programming Exercise 1, page 267 Design the logie for a program that allows a user to enter 12 numbers, then displays them in the reverse order of their entry a. Answer: start Declarations Declare a constant for the size of the array num count num index num MAX num numbers [MAX NUMBERS] . 0,0,0,0,0,0,0,0 -12 Declare the array. fill it with zeroes output "elcome to the Reverser." output ”This program will accept a set of ", MAX NUMBERS numbers and display them in reverse order of entry" Set count to zero, which accomplishes two things I. Set our ruming count of spots in the array that have currently been used to zero (we have not used any spots yet) The count variable will also be used to keep track of which array index we will be using next. Right now, since we have yet to store anything in the array, we are at index zero. count0 2. Type here to search

Explanation / Answer

Pseudo code that read a planet number from user and check if the valid number then print the planet name ,distance and diameter. Then prompts two planet numbers and print the distance between two planets.

Start
Declarations
num MAX_PLANETS=8
   string planets[MAX_PLANETS]={"Mercury","Venus","Earth","Mars","Jupitar","Saturn","Uranus","Neptune"}
   num distance[MAX_PLANETS]={36,67.2,93,483.6,483.6,886.7,1784.0,2794.4}
   num dimeter[MAX_PLANETS]={3031,7521,7926,4222,88729,74600,326000,30200}
   num planetNum

num planetNum1

   num planetNum2
  
   OUTPUT "Enter planet number :[0-8]"
   READ planetNum
  
   IFplanetNum<0 or planetNum>8
       OUTPUT "Invalid choice"
   ELSE:
       OUTPUT "Planet #",planetNum,planets[planetNum]," is ",distance[planetNum],
       " million miles from the sun and has a diameter of ",diameter[planetNum]," miles"

   OUTPUT "Enter planet number1 :[0-8]"
       READ planetNum1
   OUTPUT "Enter planet number2 :[0-8]"
       READ planetNum2

   IF (planetNum1<0 or planetNum1>8 ) or(planetNum2<0 or planetNum2>8 )
       OUTPUT "Invalid choice"
   ELSE IF(planetNum1>planetNum2)
       planetsDistance=distance[planetNum1]-distance[planetNum2]
   ELSE IF(planetNum2>planetNum1)
       planetsDistance=distance[planetNum2]-distance[planetNum1]
       OUTPUT planets[planetNum1]," is at a distance of ",planetsDistance," from ", planets[planetNum2]," miles"
   END IF

end