/** Astrology.java - contains static method horoscope(). The horoscopes are * from the New York Post on Feb. 20, 2019. * A main method is included just in case we want to print all the * horoscopes to make sure they look okay. */ public class Astrology { public static String horoscope(String sign) { if (sign.equals("Aries")) return "It's quite likely that you will trade less than friendly\n" + "words with someone you live or work with today but it's no\n" + "big deal - in fact it will be forgotten almost immediately.\n" + "Everyone falls out occasionally, even the best of friends, so\n" + "don't turn it into a war.\n"; else if (sign.equals("Taurus")) return "If someone offers you something for nothing today you will,\n" + "of course, be suspicious, but the planets indicate there is\n" + "no hidden motive involved. At worst they are doing you a\n" + "favor now so they can ask one of you later on - and there is\n" + "nothing wrong with that.\n"; else if (sign.equals("Gemini")) return "There are so many interesting things going on around you at\n" + "the moment, so don't waste time on trivialities or trying to\n" + "get ahead of rivals in small but unimportant ways.\n" + "Expand your awareness to embrace the whole wide world.\n" + "What you see will delight you.\n"; else if (sign.equals("Cancer")) return "You may be finding it hard to get through to loved ones,\n" + "thanks to the influence of Saturn in your opposite sign,\n" + "but Mercury, planet of communication, will come to your\n" + "rescue today. You may find your voice for a few minutes\n" + "but you'll say a lot.\n"; else if (sign.equals("Leo")) return "Listen to what a friend has to tell you today and if what\n" + "they say has financial implications for you personally\n" + "you must act on it immediately. If you don't take\n" + "advantage of the situation you can be sure one of your many\n" + "rivals will. Be first. Be best.\n"; else if (sign.equals("Virgo")) return "Weigh your options carefully before making a move today.\n" + "According to the planets there is a possibility that a rival\n" + "or competitor has set up a trap for you and is expecting\n" + "you to stumble into it with both eyes closed.\n" + "You're nowhere near that stupid though.\n"; else if (sign.equals("Libra")) return "You know exactly what what you should be doing, so get on\n" + "and do it and don't worry about the consequences. Life will\n" + "go well for you if you trust your instincts and don't\n" + "overthink what might happen tomorrow or next week.\n" + "Act first and don't worry about it later.\n"; else if (sign.equals("Scorpio")) return "If you ask a friend or family member what they think about\n" + "what you are doing it is more than likely that their response\n" + "will be negative. So don't ask them. Have the courage\n" + "of your convictions today and follow the path that feels\n" + "right for you.\n"; else if (sign.equals("Sagittarius")) return "People you work with and for are impressed by your attitude\n" + "and application and there is every possibility that some kind\n" + "of offer, or maybe even a promotion, will be coming your way\n" + "very soon. Keep at it and keep your reputation right up\n" + "there where it belongs.\n"; else if (sign.equals("Capricorn")) return "Sometimes you love the limelight and sometimes it scares\n" + "you and sometimes you just cannot be bothered to put on a\n" + "show to make other people happy. Today's Mercury-Saturn\n" + "link suggests you need to be alone for a while -\n" + "so, no big performance today.\n"; else if (sign.equals("Aquarius")) return "Mercury, planet of communication, is on good form today,\n" + "making it easier than usual to get your message across.\n" + "You must, however, be selective about who you speak with and\n" + "what you choose to tell them. Don't waste your breath on\n" + "trivial people and trivial events.\n"; else if (sign.equals("Pisces")) return "You will take an original approach to a familiar problem\n" + "today and will be amazed how quickly you find a solution.\n" + "Is it because circumstances have changed? No, it's because\n" + "you have changed your way of thinking. By shifting your\n" + "focus you understand the issue better.\n"; // Should not get this far else return String.format("Error: unknown sign %s\n", sign); } public static void main(String [] args) { String [] sign = { "Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", "Scorpio", "Sagittarius", "Capricorn", "Aquarius", "Pisces" }; for (int i = 0; i < sign.length; ++i) System.out.printf("Sign # %d (%s) horoscope:\n%s\n", i + 1, sign[i], horoscope(sign[i])); } }