Yuvalxp8 icon

Date Main

Yuvalxp8 | PRO | 02/03/17 01:37:09 PM UTC | 0 ⭐ | 378 👁️ | Never ⏰ | []
Java |

770 B

|

None

|

0 👍

/

0 👎

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");
            }
    }
 
}

Comments