Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Java by danielluscombe ( 5 years ago )
/**
* Write a description of your class here.
*
*/
import java.util.Scanner;
public class HandshakeSim
{
public static void main(String [] args)
{
Human player1 = new Human ("Todd");
Human player2 = new Human ("Rob Wargo");
Human player3 = new Human ("Scorpian Lady");
Human player4 = new Human ("Michael Senzapuara");
Scanner in = new Scanner(System.in);
boolean keepPlaying = true;
int input = 0;
System.out.println("Welcome to HandShake Sim");
while(keepPlaying == true)
{
System.out.println("Type 1 for Todd to shake hands with Mr.Wargo");
System.out.println("Type 2 for Todd to shake hands with Scorpion Lady");
System.out.println("Type 3 for Todd to shake hands with Michael Senzapaura");
System.out.println("Type 4 for Rob Wargo to shake hands with Scorpion Lady");
System.out.println("Type 5 for Rob Wargo to shake hands with Michael Senzapaura");
System.out.println("Type 6 for Scorpion Lady to shake hands with Michael Senzapaura");
input = in.nextInt();
if(input == 1)
{
player1.shake(player2);
}
else if(input == 2)
{
player1.shake(player3);
}
else if(input == 3)
{
player1.shake(player4);
}
else if(input == 4)
{
player2.shake(player3);
}
else if(input == 5)
{
player2.shake(player4);
}
else if(input == 6)
{
player3.shake(player4);
}
System.out.println("Press y to continue");
String repeat = in.nextLine();
repeat = in.nextLine();
if(repeat.equals("y"))
{
keepPlaying = true;
}
else
{
keepPlaying = false;
}
}
System.out.println("End of Simulation");
}
}
Revise this Paste