vendredi 27 novembre 2015

Problems with deal or no deal java game

The program is supposed to display a message on whether you have made a good deal or not. It doesn't display anything and I know the problem is something with my "message2" but I can't figure out what it is. I don't know how to get the message to display depending on the deal that the player has made. I have included the relative part of my code.

 public void deal()
{
    dealButton.setEnabled(false);
    noDealButton.setEnabled(false);

    String message = "You have chosen to accept the banker's offer of " + currency.format(bankerOffer) + " \nBut was it a good deal?\nIf we open your case we reveal";
    String message2 = "";


    for(int i = 0; i < unshuffledAmounts.size(); i++)
    {
        if(unshuffledAmounts.get(i).equals(yourCaseAmount))
        {
            yourCaseNumber = i;
        }
    }

    if(bankerOffer > yourCaseAmount)
    {
         message2 = "You made a good deal";
    }
    else
    {
        message2 = "Too bad, you made a bad deal";
    }

Aucun commentaire:

Enregistrer un commentaire