所以这是我现在的代码:
public class PigTry2
{
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
// Variables
int start;
int total;
//Methods
Scanner quest = new Scanner (System.in);
die1 x = new die1 ();
die2 z = new die2 ();
// Game
System.out.println("Hello. Would you like to play PIG? 1 for yes");
start = quest.nextInt();
if (start == 1){
x.roll();
z.roll();
System.out.println("You roll: "+ z.getEyes() + " " + x.getEyes());
do {
System.out.println("Would you like to roll again");
start = quest.nextInt();
if (start == 1)
x.roll();
z.roll();
System.out.println("You roll: "+ z.getEyes() + " " + x.getEyes());
} while(z.getEyes() != 1 && x.getEyes() != 1);
total =
}
}
}
我尝试了几种不同的方法,我想将发生的滚动总数相加。我根本不知道该怎么做。任何人都可以帮助我吗?