Using a two-dimensional and one-dimensional array, create a program that will display the cost of a Bahamasair ticket given the FROM and TO locations. The cities/towns to use for this program:Nassau, Freeport, harbour island and marsh harbour

string[,] island = new string[4, 1];
        island[0, 0] = "Nassau" + "210";
        island[1, 1] = "Freeport" + "$350";
        island[2, 2] = "HarbourIsland" + "$400";
        island[3, 3] = "MarshHarbour" + "$275";

        for (int i = 0; i <= 3; i++)

        {
            string element = island[i, 0];
            Console.WriteLine("{1}-, {0}", i, element);

        }

        {
            Console.WriteLine("Select the from town 0-3,");

        }
        Console.ReadLine();
        Console.WriteLine("You have chosen {2}", island);
        {
            Console.WriteLine("Please select To location 0-3");

It is giving me an error saying array index out of bounds

You declare the dimensions of island as [4,1] but you index the columns as 0, 1, 2, 3 (lines 2-5). Did you mean to do

island[0, 0] = "Nassau" + "210";
island[1, 0] = "Freeport" + "$350";
island[2, 0] = "HarbourIsland" + "$400";
island[3, 0] = "MarshHarbour" + "$275";

Okay I see what you’re say so it’ll have to be 4,4

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.