import java.util.Scanner;
public class haohao {
public static void main(String[] args) {
System.out.print("今天星期几?");
System.out.println("(请输入1-7的数字)");
int dayofweek = new Scanner(System.in).nextInt();
showweekchinese(dayofweek-1);
showweekenglish(dayofweek-1);
}
public static void showweekchinese(int dayofweek){
String[]weekdays ={"星期一","星期二","星期三","星期四","星期五","星期六","星期日"};
System.out.println(weekdays[dayofweek]);
}
public static void showweekenglish(int dayofweek){
String[]weekdays ={"monday","tueday","wedday","thuday","friday","satday","sunday"};
System.out.println(weekdays[dayofweek]);
}
}
运行结果:
今天星期几?(请输入1-7的数字)
3
星期三
wedday