package 练习;
import java.util.Arrays;
import java.util.Scanner;
import org.junit.Test;
public class two {
public static void main(String[] args) {
}
@Test
public void Text1(){
System.out.println("Hello");
}
@Test
public void Test2(){
System.out.println("world");
}
@Test
public void Testswitch2(){
System.out.println("请输入月份:");
int m=new Scanner(System.in).nextInt();
switch (m){
case 1:
System.out.println("31");
break;
case 2:
System.out.println("28");
break;
case 3:
System.out.println("31");
break;
case 4:
System.out.println("30");
break;
case 5:
System.out.println("31");
break;
case 6:
System.out.println("30");
break;
case 7:
System.out.println("31");
break;
case 8:
System.out.println("31");
break;
case 9:
System.out.println("30");
break;
case 10:
System.out.println("31");
break;
case 11:
System.out.println("30");
break;
case 12:
System.out.println("31");
break;
default:
System.out.println("输入错误,请输入1到12月份");
}
}
@Test
public void Testswitch3(){
System.out.println("请输入一个月份;");
int m=new Scanner(System.in).nextInt();
switch(m){
case 1 :case 2: case 3:
System.out.println("春天");
break;
case 4 :case 5: case 6:
System.out.println("夏天");
break;
case 7:case 8: case 9:
System.out.println("秋天");
break;
case 10 :case 11: case 12:
System.out.println("冬天");
break;
default:
System.out.println("封思源是我儿");
}
}
@Test
public void Testswitch4(){
System.out.println("请输入一个数字");
int n=new Scanner(System.in).nextInt();
switch(n){
case 0:
System.out.println("星期一");
break;
case 1:
System.out.println("星期二");
break;
case 2:
System.out.println("星期三");
break;
case 3:
System.out.println("星期四");
break;
case 4:
System.out.println("星期五");
break;
case 5:
System.out.println("星期六");
break;
case 6:
System.out.println("星期日");
break;
default:
System.out.println("克依木是我儿");
}
}
@Test
public void Testswitch5(){
System.out.println("请输入员工等级:");
String grade=new Scanner(System.in).next();
switch(grade){
case "A":
System.out.println("加薪数量500");
break;
case "B":
System.out.println("加薪数量300");
break;
case "C":
System.out.println("加薪数量100");
break;
default:
System.out.println("其他级别输入错误");
}
}
@Test
public void Continue(){
for(int i=100;i<=200;i++){
if(i%3!=0){
System.out.println(i);
continue;
}
}
}
@Test
public void Continue2(){
int j= 0;
for(int i=1;i<=10000;i++){
j=j+i;
}
System.out.println(j);
}
@Test
public void estswiTtch8(){
for(int j=1;j<=9;j++){
for(int i=j;i<=9;i++){
System.out.print(j+"*"+i+"="+i*j+"\t");
}
System.out.println();
}
}
@Test
public void Testswitch9(){
int arr[]={16,45,165,541,46};
int k=arr[0];
for(int i=0;i<arr.length;i++){
if(arr[i]<k){
k=arr[i];
}
}System.out.println(k);
}
@Test
public void Testswitch10(){
int arr[]={5555,45456464,4948135,45421548,8487878};
int k=arr[0];
for(int i=0;i<arr.length;i++){
if(k<arr[i]){
k=arr[i];
}
}
System.out.println(k);
}
@Test
public void Testswitch11(){
int arr[]={45145,121241,1121215,545};
Arrays.sort(arr);
for(int i=0;i<4;i++){
System.out.println(arr[i]);
}
}
@Test
public void Testswitch13(){
int WHY[]={12,45,56,98,250};
Arrays.sort(WHY);
for(int i = 0;i<5;i++)
{
System.out.println(WHY[i]);
}
}