Skip to content

Instantly share code, notes, and snippets.

@applegateaustin
Created September 19, 2012 00:37
Show Gist options
  • Save applegateaustin/3746951 to your computer and use it in GitHub Desktop.
Save applegateaustin/3746951 to your computer and use it in GitHub Desktop.
SeasonStartDay.java
import java.util.Scanner;
public class SeasonStartDay
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
//declaring variables
int userInput = 0;
String spring = "Tuesday, March 20, 2012.";
String summer = "Wednesday, June 20, 2012.";
String fall = "Saturday, September 22, 2012";
String winter = "Friday, December 21, 2012";
String season = "";
String choosenSeason = "";
System.out.println("Enter 0 for Spring");
System.out.println("Enter 1 for Summer");
System.out.println("Enter 2 for Fall");
System.out.println("Enter 3 for Winter");
userInput = keyboard.nextInt();
if (userInput == 0)
{
//System.out.println("The start of Spring will be on " + spring);
season = "Spring";
choosenSeason = spring;
}
else if (userInput == 1)
{
//System.out.println("The start of Summer will be on " + summer);
season = "Summer";
choosenSeason = summer;
}
else if (userInput == 2)
{
//System.out.println("The start of Fall will be on " + fall);
season = "Fall";
choosenSeason = fall;
}
else if (userInput == 3)
{
//System.out.println("The start of Winter will be on " + winter);
season = "Winter";
choosenSeason = winter;
}
do
{
System.out.println("The start of " + season + " Will be on " + choosenSeason);
}
while (userInput <= 3 && userInput >= 0);
System.out.println("Enter 0 for Spring");
System.out.println("Enter 1 for Summer");
System.out.println("Enter 2 for Fall");
System.out.println("Enter 3 for Winter");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment