Hello everyone,
I am making a Fortune Teller program for a University project, and I am a little confused as to why I keep getting this error when i try to compile. Here is my code:
public class Fortune
{
private int insertNumber;
private int showFortune;
/**
* Constructor for objects of class Fortune.
*/
public Fortune()
{
insertNumber = 0;
}
/**
* User inserts a number and a fortune is told.
*
*/
public int insertNumber(int number)
{
if(number < 1){
System.out.print("Please insert a number between 1 and 4");
}
if(number > 1){
System.out.print("You will become rich");
System.out.print("You will meet your evil twin in 2 days");
System.out.print("Look out for the number 8. It means danger");
System.out.print("You will lose your memory after today!");
}
if(number < 4){
System.out.print("You will become rich");
System.out.print("You will meet your evil twin in 2 days");
System.out.print("Look out for the number 8. It means danger");
System.out.print("You will lose your memory after today!");
}
if(number > 4){
System.out.print("Please enter a number between 1 and 4");
}
} -- ERROR IS HERE -- It highlights this bracket.
}
Could you please help me?
Also, if there are too many brackets at the end, i take one away but i get another error message saying 'reached end of file while parsing' that highlights the LAST bracket. I am so confused!
Thanks everyone!
T.1024