import java.util.Scanner;
public class ZodiacSign{
public static void main(String args[]){
Scanner input = new Scanner(System.in);
int Feb,March,ZodiacSign,Pisces,Aquarius,Aries,Taurus;
int selection;
System.out.println("Feb");
System.out.println("Feb 1,2,3,4
Feb 5,6,7,8
Feb 9,10,11,12
Feb 13,14,15,16
Feb 17,18,19,20
Feb 21,22, 23, 24
Feb25,26,27,28
March 1,2,3,4
March 5,6,7,8
March 9,10,11,12
March 13,14,15,16
March17,18,19,20
March 21,22,23,24
March 25,26,27,28
March 29,30,31");
System.out.println("Please enter your date of birth");
System.out.println("Please enter your month of birth");
selection = input.nextInt();
if(Feb>= 19){
ZodiacSign = Pisces ;
System.out.println("Your zodiac sign is Pisces");
}
else
{
System.out.println("Your zodiac sign is Aquarius");
}
if(March>=22){
ZodiacSign = Aries;
System.out.println("Your zodiac sign is Aries");
}
else
{
System.out.println("Your zodiac sign is Taurus");
}
System.out.println("End of Program");
}
}
Its giving me four errors:
ZodiacSign.java:19:error: variable Feb might not have been initialized
if(Feb>= 19){
^
ZodiacSign.java:20:error: variable Pisces might not have been initialized
ZodiacSign= Pisces ;
^
ZodiacSign.java:27:error: variable March might not have been initialized
if(March>= 22){
^
ZodiacSign.java:28:error: variable Aries might not have been initialized
ZodiacSign= Aries ;
^
See Question&Answers more detail:
os