Trying to get a horoscope program to determine sign for entered date. Date is int while Month is String. When started, the program will ask for the date, but after that it skips the Month input and println “capricorn” which is at the last else statement of the program. Can’t seem to figure out why it won’t let you input the Month.
import java.lang.Math;
import java.util.Scanner;
public class Main{
public static void main(String args){
Scanner scan = new Scanner (System.in);
System.out.println("input your date : ");
int date = scan.nextInt();
System.out.println("input your month : ");
String month = scan.nextLine();
if((date>21&&month=="December")||(date<=19&&month=="January")){
System.out.println("Your zodiac sign is Capricorn");
}
else if((date>20&&month=="January")||(date<=18&&month=="February")){
System.out.println("Your zodiac sign is Aquarius");
}
else if((date>19&&month=="February")||(date<=20&&month=="March")){
System.out.println("Your zodiac sign is Pisces");
}
else if((date>21&&month=="March")||(date<=20&&month=="April")){
System.out.println("Your zodiac sign is Aries");
}
else if((date>21&&month=="April")||(date<=20&&month=="May")){
System.out.println("Your zodiac sign is Taurus");
}
else if((date>21&&month=="May")||(date<=20&&month=="June")){
System.out.println("Your zodiac sign is Gemini");
}
else if((date>21&&month=="June")||(date<=20&&month=="July")){
System.out.println("Your zodiac sign is Cancer");
}
else if((date>21&&month=="July")||(date<=20&&month=="August")){
System.out.println("Your zodiac sign is Leo");
}
else if((date>21&&month=="August")||(date<=22&&month=="September")){
System.out.println("Your zodiac sign is Virgo");
}
else if((date>23&&month=="August")||(date<=20&&month=="October")){
System.out.println("Your zodiac sign is Libra");
}
else if((date>21&&month=="Octtober")||(date<=22&&month=="November")){
System.out.println("Your zodiac sign is Scorpio");
}
else{
System.out.println("Your zodiac sign is Sagitarius");
}
}
}