Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class DateUse
- {
- public static void main(String[] args)
- {
- Scanner in = new Scanner(System.in);
- System.out.println("Enter date (Day, Month, Year)");
- Date date = new Date(in.nextInt(),in.nextInt(), in.nextInt());
- if(date.getMonth() == 12 || date.getMonth() <= 3)
- {
- System.out.println("Winter");
- }
- else if(date.getMonth() == 4 || date.getMonth() == 5)
- {
- System.out.println("Spring");
- }
- else if(date.getMonth() >= 6 && date.getMonth() <= 9)
- {
- System.out.println("Summer");
- }
- else if(date.getMonth() == 10 || date.getMonth() == 11)
- {
- System.out.println("Autumn");
- }
- }
- }
Add Comment
Please, Sign In to add comment