Removing code smell from Room Booking code I am new with coding and I recently read an article about code refactoring, so I have made a console application for booking rooms on a ship. I need help with code refactoring. As far as I understand the refactoring, I think in my project there are only 2 parts where I need refactoring, which are as follows.

One is a block of for statements:

    ship1 = new Ship("Olympic Countess");

    ArrayList groupA = new ArrayList();
    for (int i = 0; i &lt; 10; i++)
    {
        groupA.Add(new room(5000, "A" + (i + 1)));
    }

    ArrayList groupB = new ArrayList();
    for (int i = 0; i &lt; 10; i++)
    {
        groupB.Add(new room(4000, "B" + (i + 1)));
    }

    ArrayList groupC = new ArrayList();
    for (int i = 0; i &lt; 30; i++)
    {
        groupC.Add(new room(3500, "C" + (i + 1)));
    }

    ArrayList groupD = new ArrayList();
    for (int i = 0; i &lt; 36; i++)
    {
        groupD.Add(new room(3400, "D" + (i + 1)));
    }

    ArrayList groupE = new ArrayList();
    for (int i = 0; i &lt; 40; i++)
    {
        groupE.Add(new room(3300, "E" + (i + 1)));
    }

    ArrayList groupF = new ArrayList();
    for (int i = 0; i &lt; 30; i++)
    {
        groupF.Add(new room(3400, "F" + (i + 1)));
    }

    ArrayList groupG = new ArrayList();
    for (int i = 0; i &lt; 36; i++)
    {
        groupG.Add(new room(3300, "G" + (i + 1)));
    }

    ArrayList groupH = new ArrayList();
    for (int i = 0; i &lt; 40; i++)
    {
        groupH.Add(new room(3200, "H" + (i + 1)));
    }

    ship1.addDeck("Balcony Suite", groupA);
    ship1.addDeck("Suite", groupB);
    ship1.addDeck("Deck 3 - Outside Twin", groupC);
    ship1.addDeck("Deck 2 - Outside Twin", groupD);
    ship1.addDeck("Deck 1 - Outside Twin", groupE);
    ship1.addDeck("Deck 3 - Inside Twin", groupF);
    ship1.addDeck("Deck 2 - Inside Twin", groupG);
    ship1.addDeck("Deck 1 - Inside Twin", groupH);      
}


and the other one is the if else statement as follows:

public Reservation bookPassage(String cabinclass, Customer booker, int number)
  {
    ArrayList cabins;
    if (cabinclass.Equals("a", StringComparison.OrdinalIgnoreCase))
        cabins = ship1.getDeck("Balcony Suite");
    else if (cabinclass.Equals("b", StringComparison.OrdinalIgnoreCase))
        cabins = ship1.getDeck("Suite");
    else if (cabinclass.Equals("c", StringComparison.OrdinalIgnoreCase))
        cabins = ship1.getDeck("Deck 3 - Outside Twin");
    else if (cabinclass.Equals("d", StringComparison.OrdinalIgnoreCase))
        cabins = ship1.getDeck("Deck 2 - Outside Twin");
    else if (cabinclass.Equals("e", StringComparison.OrdinalIgnoreCase))
        cabins = ship1.getDeck("Deck 1 - Outside Twin");
    else if (cabinclass.Equals("f", StringComparison.OrdinalIgnoreCase))
        cabins = ship1.getDeck("Deck 3 - Inside Twin");
    else if (cabinclass.Equals("g", StringComparison.OrdinalIgnoreCase))
        cabins = ship1.getDeck("Deck 2 - Inside Twin");
    else 
        cabins = ship1.getDeck("Deck 1 - Inside Twin");


What I don't understand is that my parameters are changing in both logic, so how can I make a separate method for this logic when my cabin class is changing every time?
None of this information should be written into your program's source code.  Rather, it should be stored in a configuration file, perhaps in XML, JSON, or YAML format  — or maybe stored in a database instead.  Not only would your code be less repetitive, it would also be more flexible, in that you wouldn't have to rebuild the application just to change trivial things such as product offerings and prices.