Question: I have errors on my java i do not know how to fix I will hight light them import java.util.Scanner; public class Test01 } Multiple
I have errors on my java i do not know how to fix I will hight light them
import java.util.Scanner;
public class Test01 }
Multiple markers at this line
- Syntax error on token "}", delete this token
- Occurrence of 'Test01'
- Syntax error, insert "ClassBody" to complete
ClassDeclaration
public static void main (String[] args) {
Scanner input = new Scanner(System.in);
// Display welcome to user
System.out.println("Fortune Teller");
// ask the user first and last name
System.out.println("What is your first name?");
String first = input.nextLine();
System.out.println("What is your last name?");
String last = input.nextLine();
// ask what year the user was born
System.out.println("What year were your born in (enter 4 digits of year ");
int year = input.nextInt();
// ask what month was the user was born
System.out.println("What month were you born in (enter 1-12");
int month = input.nextInt();// declare variable
System.out.println("What day of the month were you born in (enter 1-31");
int day = input.nextInt();
// ask user pick a fortune
System.out.println("Choose your fortune (enter 1-3)");
int fortune = input.nextInt();
// Create if statement if they choose option 1
if (fortune == 1) {
int lucky = (int)(Math.random() * 7 + 1);
// create if statement if they are extremely lucky
if (lucky ==8 || lucky == 2) {
System.out.println (first + "" + last + "you are extremely lucky"); //display output
}
//Create if statement if you get very lucky
if (lucky > 3 && lucky <8)
System.out.println (first + "" + last + "you are very lucky"); // display output
}
//Create if statement if you get barely lucky
if (lucky == 1 || lucky ==3)
System.out.println (first + "" + last + "you are barely lucky"); //display output
// Create if statement for magic number
if (fortune == 2) {
//
int magic_range = 110;
//
int magicnumber = (year * month) % magic_range;
// display magic number
System.out.println(first + "" + last +"your magic number is" + magicnumber);
// create if statement 3rd option
if (fortune ==3) {
if (month ==3 && day >= 19 || month == 2 && day <= 20) {
System.out.println(first + ""+last+"you are a pisces");
System.out.println("Pisces have a good day");
}
if (fortune ==4) {
if (month ==3 && day >= 21 || month == 4 && day <= 19) {
System.out.println(first + ""+last+"you are a aries");
System.out.println("aries have a good day");
}
if (fortune ==4) {
if (month ==4 && day >= 20 || month == 5 && day <= 20) {
System.out.println(first + ""+last+"you are a Taurus");
System.out.println("Taurus have a good day");
}
if (fortune ==5) {
if (month ==5 && day >= 21 || month == 6 && day <= 20) {
System.out.println(first + ""+last+"you are a Gemini");
System.out.println("Gemini have a good day");
}
if (fortune ==5) {
if (month ==6 && day >= 21|| month == 7 && day <= 22) {
System.out.println(first + ""+last+"you are a cancer");
System.out.println("cancer have a good day");
}
if (fortune ==7) {
if (month ==7 && day >= 23 || month == 8 && day <= 22) {
System.out.println(first + ""+last+"you are a Leo");
System.out.println("Leo have a good day");
}
if (fortune ==8) {
if (month ==8 && day >= 23 || month == 9 && day <= 22) {
System.out.println(first + ""+last+"you are a Virgo");
System.out.println("Virgo have a good day");
}
if (fortune ==10) {
if (month ==9 && day >= 23 || month == 10 && day <= 22) {
System.out.println(first + ""+last+"you are a Libra");
System.out.println("Libra have a good day");
}
if (fortune ==11) {
if (month ==10 && day >= 23 || month == 11 && day <= 23) {
System.out.println(first + ""+last+"you are a Scorpio");
System.out.println("Scorpio have a good day");
}
if (fortune ==12) {
if (month ==11 && day >= 22 || month == 12 && day <= 21) {
System.out.println(first + ""+last+"you are a Saggittarius");
System.out.println("Saggittarius have a good day");
}
if (fortune ==1) {
if (month ==12 && day >= 22 || month == 1 && day <= 19) {
System.out.println(first + ""+last+"you are a Capricorn");
System.out.println("Capricorn have a good day");
}
if (fortune ==1) {
if (month ==1 && day >= 20 || month == 2 && day <= 18) {
System.out.println(first + ""+last+"you are a Aquarius");
System.out.println("Aquarius have a good day");
}
}
} -
Multiple markers at this line
- Syntax error, insert "else Statement" to complete
IfStatement
- Syntax error, insert "}" to complete Statement
- Syntax error, insert "}" to complete MethodBody
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
