import java.util.Scanner;

 public class Solution
 {
     public static void main(String[] args)
     {
         Scanner input = new Scanner(System.in);
         System.out.print("Enter the year: ");
         int year = input.nextInt();
         input.close();

         for(int i = 1; i <= 12; i++)
             System.out.println(year + "-" + getMonth(i) + "-" + "1 is " + getWeekday(year, i, 1));
     }

     public static String getMonth(int monthValue)
     {
         String monthStr = "";

         switch(monthValue)
         {
             case 1: monthStr = "January"; break;
             case 2: monthStr = "February"; break;
             case 3: monthStr = "March"; break;
             case 4: monthStr = "April"; break;
             case 5: monthStr = "May"; break;
             case 6: monthStr = "June"; break;
             case 7: monthStr = "July"; break;
             case 8: monthStr = "August"; break;
             case 9: monthStr = "Sepetember"; break;
             case 10: monthStr = "October"; break;
             case 11: monthStr = "November"; break;
             case 12: monthStr = "December"; break;
         }

         return monthStr;
     }

     public static String getWeekday(int year, int month, int day)
     {
         if(month == 1)
         {
             month = 13;
             year--;
         }

         if(month == 2)
         {
             month = 14;
             year--;
         }

         int week = (day + 2 * month + 3 * (month + 1) / 5 + year + year / 4 - year / 100 + year / 400) % 7;
         String weekStr = "";

         switch(week)
         {
             case 0: weekStr = "Monday"; break;
             case 1: weekStr = "Tuesday"; break;
             case 2: weekStr = "Wednesday"; break;
             case 3: weekStr = "Thursday"; break;
             case 4: weekStr = "Friday"; break;
             case 5: weekStr = "Saturday"; break;
             case 6: weekStr = "Sunday"; break;
         }
         return weekStr;
     }
 }

HW5.34的更多相关文章

  1. mysql-5.6.34 Installation from Source code

    Took me a while to suffer from the first successful souce code installation of mysql-5.6.34. Just pu ...

  2. CSharpGL(34)以从零编写一个KleinBottle渲染器为例学习如何使用CSharpGL

    CSharpGL(34)以从零编写一个KleinBottle渲染器为例学习如何使用CSharpGL +BIT祝威+悄悄在此留下版了个权的信息说: 开始 本文用step by step的方式,讲述如何使 ...

  3. C#开发微信门户及应用(34)--微信裂变红包

    在上篇随笔<C#开发微信门户及应用(33)--微信现金红包的封装及使用>介绍了普通现金红包的封装和使用,这种红包只能单独一次发给一个人,用户获取了红包就完成了,如果我们让用户收到红包后,可 ...

  4. 背水一战 Windows 10 (34) - 控件(进度类): RangeBase, Slider, ProgressBar, ProgressRing

    [源码下载] 背水一战 Windows 10 (34) - 控件(进度类): RangeBase, Slider, ProgressBar, ProgressRing 作者:webabcd 介绍背水一 ...

  5. 基于Yahoo网站性能优化的34条军规及自己的见解

    1.尽量减少HTTP请求次数 终端用户响应的时间中,有80%用于下载各项内容,这部分时间包括下载页面中的图像.样式表.脚本.Flash等.通过减少页面中的元素可以减少HTTP请求的次数,这是提高网页速 ...

  6. AC日记——回文子串 openjudge 1.7 34

    34:回文子串 总时间限制:  1000ms 内存限制:  65536kB 描述 给定一个字符串,输出所有长度至少为2的回文子串. 回文子串即从左往右输出和从右往左输出结果是一样的字符串,比如:abb ...

  7. 34 网络相关函数(二)——live555源码阅读(四)网络

    34 网络相关函数(二)——live555源码阅读(四)网络 34 网络相关函数(二)——live555源码阅读(四)网络 2)socketErr 套接口错误 3)groupsockPriv函数 4) ...

  8. Yahoo!网站性能最佳体验的34条黄金守则(转载)

    1.       尽量减少HTTP请求次数  终端用户响应的时间中,有80%用于下载各项内容.这部分时间包括下载页面中的图像.样式表.脚本.Flash等.通过减少页面中的元素可以减少HTTP请求的次数 ...

  9. NYOJ题目34韩信点兵

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAskAAAHiCAIAAACV1MbSAAAgAElEQVR4nO3dPXLjONeG4W8TyrUQx1 ...

随机推荐

  1. 跨平台Unicode与UTF8互转代码

    参考来源:http://blog.csdn.net/flying8127/article/details/1598521 在原来原基础上,将代码整理,并加强安全性. 并按照WindowsAPI设计, ...

  2. 【leetcode】Intersection of Two Linked Lists(easy)

    Write a program to find the node at which the intersection of two singly linked lists begins. For ex ...

  3. WAF SSI

    http://www.2cto.com/Article/201405/299154.html

  4. Android 调用系统的拍相程序进行录像

    xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android ...

  5. [itint5]摆放窗口

    http://www.itint5.com/oj/#47 一种做法是:把矩形所占的方格都设为-1,就是个最大子矩阵和问题.复杂度o(w^2*h)或o(w*h^2),空间W*H猜想应用场景是:电脑屏幕上 ...

  6. live555源码研究(四)------UserAuthenticationDatabase类

    一.UserAuthenticationDatabase类作用 1,用户/密码管理 2,鉴权管理 二.类UserAuthenticationDatabase继承关系图                 ...

  7. linux下添加PATH环境变量

    添加PATH环境变量,第1种方法:[root@lx_web_s1 ~]# export PATH=/usr/local/webserver/mysql/bin:$PATH 再次查看: [root@lx ...

  8. php Late Static Bindings延迟静态绑定

    官网说道: As of PHP 5.3.0, PHP implements a feature called late static bindings which can be used to ref ...

  9. 【Lucene3.6.2入门系列】第04节_中文分词器

    package com.jadyer.lucene; import java.io.IOException; import java.io.StringReader; import org.apach ...

  10. General Ledger Useful SQL Scripts – Oracle Applications 11i

    General Ledger Useful SQL Scripts – Oracle Applications 11i Contents GL Set of Books Configuration O ...