控制台直接输入阿拉伯数字自动翻译成相应的英文星期

package lianxi;

import java.util.Scanner;

public class Xingqi {
    //输入阿拉伯数字自动翻译成相应的英文星期
    //直接在控制台输入
    
    public static void main(String[] args) {
        // TODO 自动生成的方法存根
        Scanner xingqi = new Scanner(System.in);
        System.out.println("请输入您想翻译的星期数:");
        long week = xingqi.nextLong();
        if (week == 1) {
            System.out.println("Monday");
        } else if (week == 2) {
            System.out.println("Tuesday");
        } else if (week == 3) {
            System.out.println("Wednesday");
        } else if (week == 4) {
            System.out.println("Thursday");
        } else if (week == 5) {
            System.out.println("Firday");
        } else if (week == 6) {
            System.out.println("Saturday");
        } else if (week == 7) {
            System.out.println("Sunday");
        } else {
            System.out.println("没有这一天哟");
        }
        
    }

}

如果输入1-7则:

如果输入大于7

posted @ 2016-01-04 16:09  梦里梦到梦  阅读(253)  评论(0编辑  收藏  举报