Switch statements. In Zodiac.java, write a program that reads in a number from 1-12. Pass that value to the function get
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Switch statements. In Zodiac.java, write a program that reads in a number from 1-12. Pass that value to the function get
Switch statements. In Zodiac.java, write a program that reads in a number from 1-12. Pass that value to the function getZodiacName. Then use a switch statement to return the zodiac name corresponding to the number as a String. The western zodiac has 12 signs. While this isn't important, the first sign starts on March 21st with the Spring equinox, which was the beginning of the Persian New Year. The signs are:< E 1. Aries 2. Taurus 3. Gemini 4. Cancer 5. Leo 6. Virgo 7. Libra 8. Scorpio 9. Sagittarius 10. Capricorn 11. Aquarius 12. Pisces The result of get ZodiacName should be null if the number passed is not between 1 and 12 (inclusive), in which case the statement System.out.println("Invalid zodiac number"); should be printed www