Skip to content

Instantly share code, notes, and snippets.

@Angel-Rojas
Last active June 8, 2017 01:18
Show Gist options
  • Save Angel-Rojas/622137fcd4ee94bbeae6 to your computer and use it in GitHub Desktop.
Save Angel-Rojas/622137fcd4ee94bbeae6 to your computer and use it in GitHub Desktop.
Seasons, it takes in user input and then decides what "Season" your specified date lands on. *still needs some work*
/*
* This program prints the seasons
*
* @author Angel Rojas
* Course: COMP B11
* Created: Sep 25, 2014
* Source File: Seasons.java
*/
import java.util.Scanner;
public class Seasons {
public static void main(String[] args) {
Scanner in = new Scanner(System.in); // set up our Input take-in Scanner.
String season = "Your unchanged season."; // Edit: This will print if invalid # is passed.
// user enters month and day
System.out.println("Please enter Month followed by Day");
int month = in.nextInt();
int day = in.nextInt();
// checks month and day!
if (month <= 3) {
season = "Winter";
} else if (month == 4 || month == 5 || month == 6) {
season = "Spring";
} else if (month == 7 || month == 8 || month == 9) {
season = "Summer";
} else if (month == 10 || month == 11 || month == 12) {
season = "Fall";
}
if (month % 3 == 0 && day >= 21) {
if (season.equals("Winter")) {
season = "Spring";
} else if (season.equals("Spring")) {
season = "Summer";
} else if (season.equals("Summer")) {
season = "Fall";
} else
season = "Winter";
}
System.out.print(season);
in.close(); // close out our Input reader
}
}
@pathawks
Copy link

pathawks commented Nov 9, 2015

@ChadH1971 You used the clone URL, which is what you would use if you wanted to copy the Gist to your computer using a Git client. To share the page, just copy the URL from your browser like you would for any other webpage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment