Level 5 - One-dimension arrays and lists 0 of 9 activities solved
  1. RPG inventory Not yet solved
  2. Search for life Not yet solved
  3. Two-dice pig Not yet solved
  4. Random name generator Not yet solved
  5. Cup draw Not yet solved
  6. Feud Not yet solved
  7. Darts Not yet solved
  8. Cut the deck Not yet solved
  9. London underground Not yet solved
Next series Level 6 - Count controlled iterations and scope
Level 5 - One-dimension arrays and lists

Search for life

Sign in to hand in your solution and get feedback.

// 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)); } }