I need to spin the dice by pressing the Enter key, of which the operation is in another file. How can I do this?
public class Dice {
public static void main(String[] args) {
Printer.print("Press 'enter' to roll the dices");
}
}
This is the code to turn the dice:
import java.util.Random;
public class Logic {
public static void dice() {
Random rnd = new Random();
int dice1 = (int)(rnd.nextInt(6) + 1);
int dice2 = (int)(rnd.nextInt(6) + 1);
Printer.print("Dice 1 = " + dice1);
Printer.print("Dice 2 = " + dice2);
int sum = dice1 + dice2;
Printer.print("Roll: total = " + sum);
}
}