Lev1

导航

7.2作业 1

 练习1

练习2

 

 

 

 练习3

代码如下:

package com.day;

import java.util.Scanner;

public class Exp11 {
static Scanner sc = new Scanner(System.in);

public static void main(String[] args) {
boolean flag = true;
while(flag){
System.out.print("请输入1-7(输入0结束):");
int i = sc.nextInt();
switch(i) {
case 1:
System.out.println("今天是 \tMON");
break;
case 2:
System.out.println("今天是 \tTUE");
break;
case 3:
System.out.println("今天是 \tWED");
break;
case 4:
System.out.println("今天是 \tTHU");
break;
case 5:
System.out.println("今天是 \tFTI");
break;
case 6:
System.out.println("今天是 \tSAT");
break;
case 7:
System.out.println("今天是 \tSUN");
break;
default:
if(i == 0) {
flag = false;
}else {
System.out.println("请重新输入");
}
}
}
System.out.println("程序结束!");
}

 


}

 

posted on 2019-07-02 11:22  Lev1  阅读(121)  评论(0编辑  收藏  举报