Tuesday, October 7, 2014

beginner needs help with program!




this program is supposed to let the user play rock (0) paper (1) scissors (2) with the computer however this error message come up: Compilation Errors Detected




Line: 14



'.class' expected




help please im not sure what this means?




import java.util.*;



import java.util.Scanner;




public class Lab3



{




public static void main(String[] args){



Scanner input = new Scanner(System.in);



int scissor = 0;



int rock = 1;



int paper = 2;



Random ran = new Random();



int x = ran.nextInt(3) + 0;



int randomIndex = int computer;



int guess = input.nextInt();



if (guess == computer){



System.out.println("It's a draw!");



}



else {



if (guess < computer)



System.out.println("You lost. Better luck next time!");



}



if (guess > computer)



{



System.out.println("You won!");



}



}



}







No comments:

Post a Comment