Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.65 KB | None | 0 0
  1. public class KeyboardDice implements Dice {
  2.    
  3.     private static Scanner sc;
  4.     private int numSides;
  5.     /**
  6.      * Constructor for a Dice object. Default of six sides.
  7.      *
  8.      */
  9.     public KeyboardDice()
  10.     {
  11.         Scanner sc = new Scanner(System.in);
  12.         int numSides = 6;
  13.     }
  14.     /**
  15.      * Constructor for a Dice object. Implements scanner to allow
  16.      * number of sides to be given by user
  17.      * using scanner.
  18.      * @param numSides number of sides of Dice
  19.      */
  20.     public KeyboardDice(int numSides1)
  21.     {
  22.         numSides=numSides1;
  23.     }
  24.     @Override
  25.     public int roll() {
  26.         int x;
  27.         Scanner sc = new Scanner(System.in);
  28.         x = sc.nextInt();
  29.         return (int) Math.floor(x);
  30.     }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement