Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.*;
- import java.text.*;
- import java.math.*;
- import java.util.regex.*;
- public class Solution {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- String month = in.next();
- String day = in.next();
- String year = in.next();
- String date = month+" "+day+" "+year;
- String[] weekDays = {" ", "SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATERDAY"};
- SimpleDateFormat f = new SimpleDateFormat("MM dd yyyy");
- //Calendar c = Calendar.getInstance();
- Date d = null;
- try{
- d = f.parse(date);
- }catch(ParseException e){
- e.printStackTrace();
- }
- Calendar c = Calendar.getInstance();
- c.setTime(d);
- System.out.print(weekDays[c.get(Calendar.DAY_OF_WEEK)]);
- }
- }
Add Comment
Please, Sign In to add comment