samedi 22 octobre 2016

Using IF statements depending on user input

I currently have an assignment in which the user input [box or straight] determines a set of if statements [sorry if i do not describe my issue correctly].

if (straight bet)
{
if (all three numbers match in exact order)
    player wins $600 for each $1 wagered
    else
        player loses 
}
else // box bet
{       // player wins 
        if (players numbers contains duplicates)
            player wins $200 for each $1 wagered
         else 
             player wins $100 for each $1 wagered
            }
             else 
             player loses 
             }

so far i have:

if ("straight".equalsIgnoreCase(BetType))
{
    if ((PlayerNumber3==WinningNumber3)&&(PlayerNumber2==WinningNumber2)&&PlayerNumber1==WinningNumber1){
     System.out.println("Congrats you have won");
     System.out.println("winnings: $" + Bet *600);
}else{
      System.out.println("Better luck next time")

and it prints out fine. however i am unable to do the same for BOX in which if the user inputs BOX , it would do another set of instructions in which the numbers can be in any order , and pay out a different amount, if there are duplicate numbers it will pay out a different amount.

Sorry if i did not explain myself correctly i am a Novice and this is programming I. any assistance is appreciated.

Aucun commentaire:

Enregistrer un commentaire