I writing a program that gives the user their Egyptian zodiac sign after they input their birthday, it is supposed to run continually until the user enters stop or their sign is found.. i am very new to programming and am getting a lot of errors in the portion with all of my if statements in the program. If anyone could correct me on my mistakes and give a brief explanation on everything i did wrong/ anything i am using wrong it will be greatly appreciated. Thanks!
import java.lang.*; import java.util.*; import java.io.*; public class Program { /** * This is the main entry point for the application */ static Scanner console = new Scanner(System.in); public static void main(String args[]) { boolean x = false; do { x = false; System.out.println("This program will tell you your Egyptian Zodiac sign! Please enter the month and day of your birthday.."); System.out.println("Enter month:>"); String month1 = console.nextLine(); month1 = month1.toLowerCase(); System.out.println("Enter day:> "); int day = console.nextInt(); switch(month1) { case "january" : month1 = month1.substring(0, 2); break; case "february" : month1 = month1.substring(0, 2); break; case "march" : month1 = month1.substring(0, 2); break; case "april" : month1 = month1.substring(0, 2); break; case "may" : month1 = month1.substring(0, 2); break; case "june" : month1 = month1.substring(0, 2); break; case "july" : month1 = month1.substring(0, 2); break; case "august" : month1 = month1.substring(0, 2); break; case "september" : month1 = month1.substring(0, 2); break; case "october" : month1 = month1.substring(0, 2); break; case "november" : month1 = month1.substring(0, 2); break; case "december" : month1 = month1.substring(0, 2); break; default: month1 = month1.substring(0, 3); break; } if(month1 == "jan") { if(day>= 0 && day <= 25 ) { System.out.println("Sign of Zodiac : Sphinx"); x = true; } else if(day > 25 && day <= 31) { System.out.println("Sign of Zodiac: Shu"); x = true; } else { System.out.println("Sign of Zodiac: Error in date"); } }//ends if(month1 == "feb") { if(day>= 0 && day <= 24 ) { System.out.println("Sign of Zodiac : Shu"); x = true; } else if(day > 24 && day <= 28) { System.out.println("Sign of Zodiac: Isis"); x = true; } else { System.out.println("Sign of Zodiac: Error in date"); } }//ends if(month1 == "mar" ) { if(day>= 0 && day <= 26 ) { System.out.println("Sign of Zodiac : Isis"); x = true; } else if(day > 26 && day <= 31) { System.out.println("Sign of Zodiac: Osiris"); x = true; } else { System.out.println("Sign of Zodiac: Error in date"); } }//ends if(month1 == "apr") { if(day>= 0 && day <= 25 ) { System.out.println("Sign of Zodiac : Osiris"); x = true; } else if(day > 25 && day <= 30) { System.out.println("Sign of Zodiac: Amun"); x = true; } else { System.out.println("Sign of Zodiac: Error in date"); } }//ends if(month1 == "may") { if(day>= 0 && day <= 25 ) { System.out.println("Sign of Zodiac : Amun"); x = true; } else if(day > 25 && day <= 31) { System.out.println("Sign of Zodiac: Hathur"); x = true; } else { System.out.println("Sign of Zodiac: Error in date"); } }//ends if(month1 == "jun") { if(day>= 0 && day <= 24 ) { System.out.println("Sign of Zodiac : Hathur"); x = true; } else if(day > 24 && day <= 31) { System.out.println("Sign of Zodiac: Phoenix"); x = true; } else { System.out.println("Sign of Zodiac: Error in date"); } }//ends if(month1 == "jul") { if(day>= 0 && day <= 24 ) { System.out.println("Sign of Zodiac : Phoenix"); x = true; } else if(day > 24 && day <= 31) { System.out.println("Sign of Zodiac: Anubis"); x = true; } else { System.out.println("Sign of Zodiac: Error in date"); } }//ends if(month1 == "aug") { if(day>= 0 && day <= 28 ) { System.out.println("Sign of Zodiac : Anubis"); x = true; } else if(day > 28 && day <= 31) { System.out.println("Sign of Zodiac: Thoth"); x = true; } else { System.out.println("Sign of Zodiac: Error in date"); } }//ends if(month1 == "sep") { if(day>= 0 && day <= 27 ) { System.out.println("Sign of Zodiac : Thoth"); x = true; } else if(day > 27 && day <= 30) { System.out.println("Sign of Zodiac: Horus"); x = true; } else { System.out.println("Sign of Zodiac: Error in date"); } }//ends if(month1 == "oct") { if(day>= 0 && day <= 27 ) { System.out.println("Sign of Zodiac : Horus"); x = true; } else if(day > 27 && day <= 31) { System.out.println("Sign of Zodiac: Wadget"); x = true; } else { System.out.println("Sign of Zodiac: Error in date"); } }//ends if(month1 == "nov") { if(day>= 0 && day <= 26 ) { System.out.println("Sign of Zodiac : Wadget"); x = true; } else if(day > 26 && day <= 30) { System.out.println("Sign of Zodiac: Sekhmet"); x = true; } else { System.out.println("Sign of Zodiac: Error in date"); } }//ends if(month1 == "dec") { if(day>= 0 && day <= 26 ) { System.out.println("Sign of Zodiac : Sekhmet"); x = true; } else if(day > 26 && day <= 31) { System.out.println("Sign of Zodiac: Sphinx"); x = true; } else { System.out.println("Sign of Zodiac: Error in date"); } }//ends if(month1 == "quit") { x = true; }//ends }while(x == true); } }
Checking Libraries...
Copying files...
Processing Files...
Compiling...
Build Success
------------------------------
This program will tell you your Egyptian Zodiac sign! Please enter the month and day of your birthday..
Enter month
September
Enter day
29
Application Exited.