import java.util.*;
网站建设哪家好,找创新互联公司!专注于网页设计、网站建设、微信开发、成都小程序开发、集团企业网站建设等服务项目。为回馈新老客户创新互联还提供了资兴免费建站欢迎大家使用!
public class Test {
public static void main(String[] args) {
// TODO 自动生成方法存根
int num;
String day = "";
Scanner input = new Scanner(System.in);
do{
System.out.print("请输入数字1-3(输入0结束):");
num = input.nextInt();
switch (num) {
case 1:
day = "星期一";
System.out.println("今天是:" + day);
continue;
case 2:
day = "星期二";
System.out.println("今天是:" + day);
continue;
case 3:
day = "星期三";
System.out.println("今天是:" + day);
continue;
case 0:
break;
default:
System.out.print("请重新输入:");
num = input.nextInt();
continue;
}
}while(num != 0);
System.out.println("程序结束");
}
}
import java.util.*; public class Date { public static int main(String[] args) { Scanner scan=new Scanner(System.in); int i=scan.nextInt(); switch(i) { case 1:System.out.println("Monday");break; case 2:System.out.println("Tuesday");break; case 3:System.out.println("Wednesday");break; case 4:System.out.println("Thursday");break; case 5:System.out.println("Friday");break; case 6:System.out.println("Saturday");break; case 7:System.out.println("Sunday");break; default:System.out.println("It's invalidate!");break; } return 0; } }
public String getXqEn(int xqNum){
MapInteger,String xqMap = new HashMapInteger,String();
xqMap.put(1,"星期一");
xqMap.put(2,"星期二");
xqMap.put(3,"星期三");
xqMap.put(4,"星期四");
xqMap.put(5,"星期五");
xqMap.put(6,"星期六");
xqMap.put(7,"星期七");
String xqEn = xqMap.get(xqNum);
System.out.print(xqEn );
return xqEn;
}
把星期翻译成英文就可以了!