Computer Science, asked by EvuTime, 2 months ago

Write a Java program which will display basic information about the planets in our solar system.
By taking the input of the planet's sequence number.
Eg- If the user gives 2, then it should show the information of Venus

It should be in loop until user enters 0.

Answers

Answered by Anonymous
5

import java.util.*;

class Solar_System

{

public static void main(string args[])

{

Scanner sc=new Scanner(System. in);

int a, b, c, d, e, f, g, h, z;

a=nextInt();

b=nextInt();

c=nextInt();

d=nextInt();

e=nextInt();

f=nextInt();

g=nextInt();

h=nextInt();

z=nextInt();

if (a==1);

System.out.println(a+"is Mercury");

else if(b==2);

System.out.println(b+"is Venus");

else if(c==3);

System.out.println(c+"is Earth");

else if(d==4);

System.out.println(d+"is Mars");

else if(e==5);

System.out.println(e+"is Juptier");

else if(f==6);

System.out.println(f+"is Saturn");

else if(g==7);

System.out.println(g+"is Uranus");

else if(h==8);

System.out.println(h+"is Neptune");

else

System.out.println(z+"The number you entered is wrong");

}

}

Answered by hemantsinghhs758
0

sorry don't know the answer u do it by yourself

Similar questions