only the example output is given to us. Enter Month: 6 Enter Year: 1990 Enter day: 4 Zodiac Sign : Virgo Birth stone : pearl
5 Answers
New Answer8/20/2018 12:34:58 PM
Romel Catubig5 Answers
New Answerint month , year, day, system.out.print("enter month") month = sc.nextInt(); system.out.print("enter year:") yeat = sc.nextInt(); system.out.print("enter day") day = sc.nextInt(); just like that. then how can i compute those inputted by the user.
@Romel Catubig In case of stones using if-else here is not the best solution. They are dependent on months only afaik. I would make an array and fill the array with the names of stones. Then you just need to print out stonesArray[month-1] and you will get the answer. In case of zodiac it seems to be more complicated, as it is determined based on exact days. Perhaps, if-else is suitable here. Using if-else conditions you'll need to check the input date 12 times e.g. if ((month == 1 && day >= 20) || (month == 2 && day <= 18)) //output Aquarius else if ((month == 2 && day >= 19) || (month == 3 && day <= 20)) // output Pisces else if ... ... ... ... else // output Capricorn
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message