Java code not executing as expected
<p>I've written some Java code, as shown below, but it isn't behaving as I expected. Right near the bottom, starting from the line <code>if (upgrade == "Y")</code>. I did a test, I entered <code>Y</code> but this line did not execute. Could you please help me figure out why this behaviour occurred?</p>

<pre><code>import java.io.*;

class P4
{
public static int get_price(String day_of_week, String age_group)
{
    int price=0;

    if (day_of_week == "WD")
    {
        if (age_group == "adult")
            price = 66;

        else if (age_group == "child")
            price=48;

        else
            price = 32;
    }
    else
    {
        if (age_group == "adult")
            price = 72;

        else if (age_group == "child")
            price=52;

        else
            price = 36;
    }

    return price;
}

public static void main(String[] args)
{
    String adult2=null;
    String child2=null;
    String senior2=null;
    String day_of_week=null;
    String upgrade=null;


    System.out.println("Enter Number of Adult Ticket:");
    BufferedReader adult1 = new BufferedReader(new InputStreamReader(System.in));
    try
    {
        adult2 = adult1.readLine();     
    } 
    catch (IOException e) {
        System.out.println("Error!");
        System.exit(1);
    }

    System.out.println("Enter Number of Child Ticket:");
    BufferedReader child1 = new BufferedReader(new InputStreamReader(System.in));
    try
    {
        child2 = child1.readLine();     
    } 
    catch (IOException e) {
        System.out.println("Error!");
        System.exit(1);
    }

    System.out.println("Enter Number of Senior Ticket:");
    BufferedReader senior1 = new BufferedReader(new InputStreamReader(System.in));
    try
    {
        senior2 = senior1.readLine();       
    } 
    catch (IOException e) {
        System.out.println("Error!");
        System.exit(1);
    }

    System.out.println("Choose Weekday or Weekend Pass (WD/WE):");
    BufferedReader day_of_week1 = new BufferedReader(new InputStreamReader(System.in));
    try
    {
        day_of_week = day_of_week1.readLine();      
    } 
    catch (IOException e) {
        System.out.println("Error!");
        System.exit(1);
    }

    System.out.println("Upgrade to Express Pass (Y/N):");
    BufferedReader upgrade1 = new BufferedReader(new InputStreamReader(System.in));
    try
    {
        upgrade = upgrade1.readLine();      
    } 
    catch (IOException e) {
        System.out.println("Error!");
        System.exit(1);
    }

    int adult = Integer.parseInt(adult2);
    int child = Integer.parseInt(child2);
    int senior = Integer.parseInt(senior2);

    int total_a = adult * get_price(day_of_week, "adult");
    int total_c = child * get_price(day_of_week, "child");
    int total_s = senior * get_price(day_of_week, "senior");

    int total_price = total_a + total_c + total_s;

    int total_people = adult + child + senior;

    int upgrade_price = 0;

    if (upgrade == "Y")
    {
        if (day_of_week == "WD")
        {
            upgrade_price = total_people * 30;
        }
        else
        {
            upgrade_price = total_people * 68;
        }
    }
    else
        upgrade_price = 0;


    int price = upgrade_price + total_price;

    System.out.println("The total price is $" + price);

}}
</code></pre>
