Search for life

Sign in to test your solution.
// Search for life program using System; class Submission { // ------------------------- // Subprograms // ------------------------- static string probe(int planet) { Random random_generator = new Random(planet); string[] creature = { "lizards", "humanoids", "insects" }; string[] colour = { "red", "green", "blue" }; string[] characteristic = { "shy", "angry", "docile" }; int lifeform = random_generator.Next(0, 3); int specimen = random_generator.Next(0, 3); int behaviour = random_generator.Next(0, 3); string report = ""; report = colour[specimen]; report = report + ", " + characteristic[behaviour]; report = report + " " + creature[lifeform]; report = report + " on the planet."; return report; } // ------------------------- // Main program // ------------------------- public static void Main(string[] args) { Console.WriteLine("Enter the catalogue number of a planet:"); int planet = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Probes report " + probe(planet)); } }
You can submit as many times as you like. Only your latest submission will be taken into account.
Sign in to test your solution.