请帮我用JAVA数组的方式编写一个课程表,感激不尽!

一周有七天,上午四节,下午四节,晚上两节,每节45分钟!

第1个回答  2015-10-07
public class IdUtil {

public static void main(String[] args) {

//七天的课程
String[] week = new String[7];

//每天的课程名
week[0] = "语文,语文,语文,语文,语文,语文,语文,语文,语文,语文";
week[1] = "数学,数学,数学,数学,数学,数学,数学,数学,数学,数学";
week[2] = "外语,外语,外语,外语,外语,外语,外语,外语,外语,外语";
week[3] = "物理,物理,物理,物理,物理,物理,物理,寂寞学,物理,物理";
week[4] = "化学,化学,化学,化学,化学,化学,化学,化学,化学,化学";
week[5] = "生物,生物,生物,生物,生物,生物,生物,生物,生物,生物";
week[6] = "寂寞学,寂寞学,寂寞学,寂寞学,寂寞学,寂寞学,寂寞学,寂寞学,寂寞学,寂寞学";

//上课时间
String[] time = {"8:00","9:00","8:00","8:00","8:00","8:00","8:00","8:00","8:00","8:00"};

for(int a=1;a<8;a++){
System.out.print("\t"+"星期"+a);
}
System.out.println();

int b = 0;
for(int i=1;i<11;i++){
switch (i) {
case 1:
System.out.println("上午");
break;
case 5:
System.out.println("下午");
break;
case 9:
System.out.println("晚上");
break;
}

System.out.print(time[i-1]+"\t");
for(int j=0;j<7;j++){
System.out.print(week[j].split(",")[b]+"\t");
}
System.out.println();
b++;
}

}
}本回答被网友采纳
第2个回答  2015-10-07
你的需求不是很具体,能详细说下吗追问

就是帮我用JAVA编写一个课程表代码,越简单越好,最好用到数组!

相似回答
大家正在搜