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

write in pseudocode 2) An astronomy application displays information about the e

ID: 3603057 • Letter: W

Question

write in pseudocode

2) 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://space-facts.com/planets/

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

Explanation / Answer

import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; /** * Created by Jonnadula Prithvi on 27-10-2017. */ public class Sample { public static void main(String ...x) { Scanner s=new Scanner(System.in); System.out.println("Enter number of queries:"); int n=s.nextInt(); for (int i=0;i