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

Tuesday, September 3, 2019

Codecademy Accessing Array Items 4/8


// Sample Solution
using System;

namespace AccessingArrays
{
  class Program
  {
    static void Main(string[] args)
    {   
      string[] summerStrut;
     
      summerStrut = new string[] { "Juice", "Missing U", "Raspberry Beret", "New York Groove", "Make Me Feel", "Rebel Rebel", "Despacito", "Los Angeles" };
     
      int[] ratings = { 5, 4, 4, 3, 3, 5, 5, 4 };
      Console.WriteLine("You rated the song " + summerStrut[1] + ratings[1] + " stars.");
      //PrintStatement(summerStrut, ratings, 1);
    }
   
    static void PrintStatement(string[] summerStrut, int[] ratings, int songIndex)
    {
      string songName = summerStrut[songIndex];
      int rating = ratings[songIndex];
      Console.WriteLine($"You rated the song {songName} {rating} stars."); 
    }
  }
}

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts