forked from sanjeeth-07/Hacktoberfest2019
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Zodiac.java
109 lines (91 loc) · 2.68 KB
/
Zodiac.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/ Java program to display astrological sign
// or Zodiac sign for given date of birth
import java.io.*;
class Zodiac {
static void zodiac_sign(int day, String month)
{
String astro_sign="";
// checks month and date within the
// valid range of a specified zodiac
if (month == "december"){
if (day < 22)
astro_sign = "Sagittarius";
else
astro_sign ="capricorn";
}
else if (month == "january"){
if (day < 20)
astro_sign = "Capricorn";
else
astro_sign = "aquarius";
}
else if (month == "february"){
if (day < 19)
astro_sign = "Aquarius";
else
astro_sign = "pisces";
}
else if(month == "march"){
if (day < 21)
astro_sign = "Pisces";
else
astro_sign = "aries";
}
else if (month == "april"){
if (day < 20)
astro_sign = "Aries";
else
astro_sign = "taurus";
}
else if (month == "may"){
if (day < 21)
astro_sign = "Taurus";
else
astro_sign = "gemini";
}
else if( month == "june"){
if (day < 21)
astro_sign = "Gemini";
else
astro_sign = "cancer";
}
else if (month == "july"){
if (day < 23)
astro_sign = "Cancer";
else
astro_sign = "leo";
}
else if( month == "august"){
if (day < 23)
astro_sign = "Leo";
else
astro_sign = "virgo";
}
else if (month == "september"){
if (day < 23)
astro_sign = "Virgo";
else
astro_sign = "libra";
}
else if (month == "october"){
if (day < 23)
astro_sign = "Libra";
else
astro_sign = "scorpio";
}
else if (month == "november"){
if (day < 22)
astro_sign = "scorpio";
else
astro_sign = "sagittarius";
}
System.out.println(astro_sign);
}
// Driver code
public static void main (String[] args)
{
int day = 19;
String month = "may";
zodiac_sign(day, month);
}
}