I am very new to java, trying to learn from this book for a class and im stuck making a program. Keeps telling me else without if is an error and that it cant find the symbol labeled as guessdigit1 & 2.
It keeps saying guessdigit1 and 2 are their own class when i hover over the error dialog box next to symbol. any idea? Thank you!
package loterry;
import java.util.Scanner;
public class Loterry {
// This program creates two random numbers, and checks to see if your guess
// makes the lottery win
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Enter in your guess for loterry, two digits please");
int lottery = (int)(Math.random()*100 /50);
int guess = input.nextInt();
int lotterydigit1= lottery /10;
int lotterydigit2= lottery %10;
// Get digits from guess
int guessdigit1 = guess / 10;
int guessdigit2 = guess % 10;
System.out.println("The lottery number is " + lottery);
if (guess == lottery)
System.out.println("Exact Match: you win 10,000");
else if (guessdigit2 == lotterydigit1 && guessdigit1 == lotterydigit2);
System.out.println("Match all digits: you win 3,000");
else if (guessdigit1 == lotterydigit1
|| guessdigit1 == lotterydigit2
|| guessdigit2 == lotterydigit2
|| guessdigit2 == lotterydigit2)
System.out.println("match one digit: you win 1,000");
else
System.out.println("sorry no match");
}
}