only the example output is given to us. Enter Month: 6 Enter Year: 1990 Enter day: 4 Zodiac Sign : Virgo Birth stone : pearl | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

only the example output is given to us. Enter Month: 6 Enter Year: 1990 Enter day: 4 Zodiac Sign : Virgo Birth stone : pearl

20th Aug 2018, 12:34 PM
Romel Catubig
Romel Catubig - avatar
5 Answers
+ 1
int 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.
20th Aug 2018, 12:54 PM
Romel Catubig
Romel Catubig - avatar
+ 1
yes sir thats it all i need. thankyou so much sir.
20th Aug 2018, 1:37 PM
Romel Catubig
Romel Catubig - avatar
0
using If else condition guys. need help from this
20th Aug 2018, 12:35 PM
Romel Catubig
Romel Catubig - avatar
0
Show us your attempt by providing what you have coded so far and we will help you.
20th Aug 2018, 12:50 PM
Steppenwolf
Steppenwolf - avatar
0
@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
20th Aug 2018, 1:27 PM
Steppenwolf
Steppenwolf - avatar