Question: Rewrite the following code and create a function to display the planets and their diameters. Instead of the code in main, create a function to

Rewrite the following code and create a function to display the planets and their diameters. Instead of the code in main, create a function to do this. Pass both arrays to the function.

static void Main(string[] args)

{

string[] planet = new string[]{"Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"};

double[] diameter = new double[] { 4879, 12104, 12756, 6792, 142984, 120536, 51118, 49528 };

Console.WriteLine("Each planet and its diameter are shown below:");

for(int i=0;i<8;i++)

{

Console.Write(" Planet: "+planet[i]);

Console.Write("\tDiameter: "+diameter[i]);

}

Console.ReadLine();

}

}

need a conclusion statement on this as well. thanks.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!