Help - Rover Control Center

Link to Project

I am having an issue with this project. Step 3.

Back in Main() , call the DirectAll() method using the array as the argument. Make sure that the right text is printed to the screen!

The issue is that after I did this step and press Save, nothing is showing in the console?

Am I misreading this?

Is it working like it should and nothing is wrong?

I’m just confused here.

Program.cs

using System;

namespace RoverControlCenter
{
  class Program
  {
    static void Main(string[] args)
    {
      MoonRover lunokhod = new MoonRover("Lunokhod 1", 1970);
      MoonRover apollo = new MoonRover("Apollo 15", 1971);
      MarsRover sojourner = new MarsRover("Sojourner", 1997);
      Satellite sputnik = new Satellite("Sputnik", 1957); 
  		
      //Store the three rovers in an array of type Rover[], their shared base class.
      Rover[] rover = { lunokhod, apollo, sojourner };
      
      //Call the DirectAll() method using the array as the argument.
      DirectAll(rover);
    }
    
    //Write a static method that takes one argument. Method should call three methods for each element and print out the returned strings.
    static void DirectAll(Rover[] r)
    {
      foreach (Rover e in r)
      {
        e.GetInfo();
        e.Explore();
        e.Collect();
      }
    }
  }
}

To be more precise this is not outputting.

Alias: Lunokhod 1, YearLanded: 1970
Moon rover is exploring the surface!
Moon rover is collecting rocks!
Alias: Apollo 15, YearLanded: 1971
Moon rover is exploring the surface!
Moon rover is collecting rocks!
Alias: Sojourner, YearLanded: 1997
Mars rover is exploring the surface!
Mars rover is collecting rocks!

Figured it out

   public static void DirectAll(Rover[] r)
    {
      foreach (Rover e in r)
      {
        Console.WriteLine(e.GetInfo());
        Console.WriteLine(e.Explore());
        Console.WriteLine(e.Collect());
      }
    }
1 Like