Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Chap3_14HeadsOrTails {
- public static void main(String[] args) {
- Scanner grabber = new Scanner(System.in);
- int randomNumber = (int)(Math.random() *2);
- System.out.println("Enter 0 for heads or 1 for tails");
- int yourGuess = grabber.nextInt();
- if (yourGuess == randomNumber){
- System.out.println("You got it!!");
- }
- else
- System.out.println("buzzer sound");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement