Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String [] args)
- {
- Scanner console = new Scanner(System.in);
- String answer1,answer2,rules;
- int result,counter;
- boolean b;
- b=false;
- counter=0;
- System.out.println("Hey there, buddy! Wanna play a game of craps? Try your luck?");
- answer1=console.next();
- if (answer1.toLowerCase().charAt(0) == 'n'){
- System.out.println("Come back anytime, buddy!");
- System.exit(0);
- }
- System.out.println("Do you want to see the rules, buddy?");
- answer2=console.next();
- if (answer2.toLowerCase().charAt(0) == 'y'){
- Craps.rules();
- }
- do {
- Craps.play();
- counter++;
- } while(b);
- System.out.println("You played "+counter+" games before you lost. Good job, buddy! See yah, later!");
- System.exit(0);
- }
- public static boolean play()
- {
- int result=(int)(Math.random()*10+1);
- boolean b;
- if (result < (7)){
- b=true;
- return b;
- } else {
- b=false;
- return b;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement