Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class KeyboardDice implements Dice {
- private static Scanner sc;
- private int numSides;
- /**
- * Constructor for a Dice object. Default of six sides.
- *
- */
- public KeyboardDice()
- {
- Scanner sc = new Scanner(System.in);
- int numSides = 6;
- }
- /**
- * Constructor for a Dice object. Implements scanner to allow
- * number of sides to be given by user
- * using scanner.
- * @param numSides number of sides of Dice
- */
- public KeyboardDice(int numSides1)
- {
- numSides=numSides1;
- }
- @Override
- public int roll() {
- int x;
- Scanner sc = new Scanner(System.in);
- x = sc.nextInt();
- return (int) Math.floor(x);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement