Number 123
Number 123
================================================*/
import java.io.*;
do
{
mainMenu();
System.out.print("Choice: ");
String Choice_ = br.readLine();
byte choice_ = Byte.parseByte(Choice_);
System.out.print("\n");1
if (choice_==1)
{
if (player2==4)
{
System.out.print("\n");
break;
}
else
{
if(player1==player2)
{
System.out.println("Player 1: "+RPS[player1-1]);
System.out.println("Player 2: "+RPS[player2-1]);
System.out.println("It's a tie!");
}while(true);
} // if choice_ == 1
else if (choice_==2)
{
matchNumber=1;
String Choice;
byte choice;
int totalWin=0,totalLose=0,totalTie=0;
do{
menu();
System.out.print("Choice(1-5): ");
Choice = br.readLine();
choice = Byte.parseByte(Choice);
else if (option==2)
{
System.out.println("You chose: Paper");
System.out.println("Computer : Rock");
}
else if (option==3)
{
System.out.println("You chose: Rock");
System.out.println("Computer : Scissors");
}
else break;
System.out.println("You win!");
totalWin++;
matchNumber++;
} while (true); // do
break;
case 2 :
do{
boolean checkWinner = true;
boolean checkTie = false;
int computerMove = (int)(Math.random() * 3)+1;
String[] RPS = {"Rock", "Paper", "Scissors"};
game(matchNumber);
System.out.print("Option (1-4): ");
Option = br.readLine();
option = Integer.parseInt(Option);
if (option<1 || option>4)
{
System.out.println("Invalid");
}
else if (option==4)
{
break;
}
else
{
if(option==computerMove)
{
System.out.println("You chose: "+RPS[option-1]);
System.out.println("Computer : "+RPS[option-1]);
System.out.println("It's a tie!");
checkTie=true;
}
if(checkTie==false)
{
if(checkWinner)
{
System.out.println("You win");
totalWin++;
}
else
{
System.out.println("You lose");
totalLose++;
}
} // if not tie
} // else
matchNumber++;
} while(true);
break;
case 3 :
do
{
game(matchNumber);
System.out.print("Option (1-4): ");
Option = br.readLine();
option = Integer.parseInt(Option);
if (option==1)
{
System.out.println("You chose: Rock");
System.out.println("Computer : Paper");
}
else if (option==2)
{
System.out.println("You chose: Paper");
System.out.println("Computer : Scissors");
}
else if (option==3)
{
System.out.println("You chose: Rock");
System.out.println("Computer : Paper");
}
else break;
System.out.println("You lose!");
totalLose++;
matchNumber++;
} while (true); // do
break;
case 4 :
System.out.println("Standing");
System.out.println("Total number of wins : "+totalWin);
System.out.println("Total number of loses: "+totalLose);
if(matchNumber>1)matchNumber--;
break;
default :
System.out.println("Invalid Option.");
break;
} // switch
} // if main
else break;
System.out.printf("\n");
matchNumber++;
} while(true);
} // else if 2
else if(choice_==3)break;
else System.out.println("Invalid");
} while (true);
} // main
} // class