Advertisement
jaVer404

level08.lesson11.bonus01

Apr 21st, 2015
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.93 KB | None | 0 0
  1. package com.javarush.test.level08.lesson11.bonus01;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.IOException;
  5. import java.io.InputStreamReader;
  6. import java.text.ParseException;
  7. import java.text.SimpleDateFormat;
  8. import java.util.*;
  9.  
  10. /* Номер месяца
  11. Программа вводит с клавиатуры имя месяца и выводит его номер на экран в виде: «May is 5 month».
  12. */
  13.  
  14. public class Solution
  15. {
  16.     public static void main(String[] args) throws IOException, ParseException
  17.     {
  18.         //add your code here - напиши код тут
  19.         BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
  20.         String myDate = reader.readLine();
  21.         SimpleDateFormat sdf = new SimpleDateFormat("MMMM", Locale.ENGLISH);
  22.         Date myDate1 = sdf.parse(myDate);
  23.         System.out.println(myDate + " is " + ((myDate1.getMonth())+1)+" month");
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement