-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSeason
More file actions
20 lines (19 loc) · 874 Bytes
/
Season
File metadata and controls
20 lines (19 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Create a program that tells the season given the month and the day
// Created: Feb 28 2020
public class Season {
public static void main(String[] args) {
// create a variable for the month and day
int month = Integer.parseInt(args[0]);
int day = Integer.parseInt(args[1]);
// check the month and day for each season
if ((month == 3 && day >= 21) || (month == 6 && day <= 20) || month == 5 || month == 4) {
System.out.println("spring");
} else if ((month == 6 && day >= 21) || (month == 9 && day <= 22) || month == 7 || month == 8){
System.out.println("summer");
} else if ((month == 9 && day >= 23) || (month == 12 && day <= 21) || month == 10 || month == 11){
System.out.println("fall");
} else {
System.out.println("winter");
}
}
}