Quotes help make search much faster. Example: "Practice Makes Perfect"

Tuesday, September 3, 2019

Codecademy Optional Parameters 9/10


// Sample Solution
using System;

namespace MethodOverloading
{
  class Program
  {
    static void Main(string[] args)
    {
NamePets("Laika", "Albert");
      NamePets("Huey", "Duey", "Luey");
      NamePets();
    }
   
    static void NamePets(string pet1, string pet2)
    {
      Console.WriteLine($"Your pets {pet1} and {pet2} will be joining your voyage across space!");
    }
   
    static void NamePets(string pet1, string pet2, string pet3)
    {
      Console.WriteLine($"Your pets {pet1}, {pet2}, and {pet3} will be joining your voyage across space!");
    }
   
    static void NamePets()
    {
      Console.WriteLine("Aw, you have no spacefaring pets :(");
    }
  }
}

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts