public class WeekDayConverter{
public static void main(String[] args){
int weekDay = Integer.parseInt(args[0]);
if(weekDay==1){
System.out.print("The "+weekDay+"th day of the week is ");
System.out.println("Monday");
}
else if(weekDay==2){
System.out.print("The "+weekDay+"th day of the week is ");
System.out.println("Tuesday");
}
else if(weekDay==3){
System.out.println("Wensday");
}
else if(weekDay==4){
System.out.print("The "+weekDay+"th day of the week is ");
System.out.println("Thursday");
}
else if(weekDay==5){
System.out.print("The "+weekDay+"th day of the week is ");
System.out.println("Firday");
}
else if(weekDay==6){
System.out.print("The "+weekDay+"th day of the week is ");
System.out.println("Straday");
}
else if(weekDay==7){
System.out.print("The "+weekDay+"th day of the week is ");
System.out.println("Sunday");
}
else{
System.out.println("ERROR INPUT");
}
}
}
java lab1 第二题
最新推荐文章于 2023-05-03 13:24:07 发布