你只需要一个选课表,存学生ID,课程ID,所有学生的选课都是这一个表,每次选课加一条数据,展现的时候根据用户去查选课表就行了
Ⅱ 高分求助,有帮助的话追加,用java设计一个自动排班程序,大约30个学生志愿者,根据课表排班
这与java没什么关系,是数学题目,找数学系的给思路吧。
Ⅲ java学习有没有课程表
课程表没有,这是朋友在叩丁狼学习的课程大纲,可以给你看看参考一下专
第一阶段属Java基础阶段
第二阶段、JavaWeb阶段
第三阶段、Web前端阶段
第四阶段、高级框架和技术阶段
第五阶段、互联网高薪技术阶段
第六阶段、七大实战项目(项目部分)阶段
Ⅳ 用Java做一个课程表
创建2个对象 *** ,判断差异,如果存在差异就将那条数据保存为文件内容
基本就这么简单
Ⅳ 如何用java设计课程表
java设计课程表
具体可以和我谈。
Ⅵ 怎么制作一个JAVA的课程表程序(需要详细解答)
写个课程表程序倒是不难,只要使用java.util.Calendar类,可以做个万年历的课表,不过要界面就要配合swing,但是版你权要在手机上运行就不能使用j2se,要用j2me.不过个人建议不要用java,java在手机上要用java虚拟机才可以运行,效率慢,所以建议使用C++嵌入式编程
Ⅶ 请帮我用JAVA数组的方式编写一个课程表,感激不尽!
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=1a<8a++){
System.out.print("\t"+"星期"+a)
}
System.out.println()
int b = 0
for(int i=1i<11i++){
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=0j<7j++){
System.out.print(week[j].split(",")[b]+"\t")
}
System.out.println()
b++
}
}
}
Ⅷ 三张表(学生表,功课表,中间表),多对多,怎么查 学习java最多的学生和哪门语言技术学的人最多,
group by一下
Ⅸ java学习有没有课程表
课程表没有,这是朋友在叩丁狼学习的课程大纲,可以给你看看参考一下
第一阶段Java基础阶段
第二阶段、JavaWeb阶段
第三阶段、Web前端阶段
第四阶段、高级框架和技术阶段
第五阶段、互联网高薪技术阶段
第六阶段、七大实战项目(项目部分)阶段
应该用不上什么线程,一次性把所有的班都排好六个元素的数组
两个指针,一个是工作日当值人,一个是周末当值人,初始都是0
从今天开始到指定某一天,譬如年底
int idx_workday =0
int idx_weekend =0
ArrayList assignment = new ArrayList()
day = today
while(day不是年底){
int i
if (day is workday){
i = idx_workday++
assignment.add(i)
if (idx_workday >5) idx_workday = 0
}else{
i = idx_weekend++
assignment.add(i)
if (idx_weekend >5) idx_weekend= 0
}
}
output assignment
我以前遇到过类似的问题。就是做值班表 自动排班的时候。我不知道用SQL语句怎么做;而且又不想插入空数据,于是就用程序实现的。
其中有部分实现了时间段的构造,你可以看下。应该不难解决。
//半自动排班
@SuppressWarnings("unchecked")
public ActionForward automatic(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception{
ScheduletableActionForm newform = (ScheduletableActionForm)form
String id_str = request.getParameter("id")
if(id_str==null){
id_str = newform.getSchedule().getId_string()
}
long id = Long.parseLong(id_str)
Schedule schedule = ScheduleDAO.getScheduleById(id)
//排班明细结束时间由排班表决定
Date enddate = schedule.getEnddate()
//排班模板时间段由该排班表已有的明细决定
List datelist = SchedulelineDAO.getSchedulelineShowSizeScheduleId(id)
if(datelist==null||datelist.size()==0){
newform.setErrormsg("请至少先选择一个排班循环")
}
else{//该datelist长度一定大于0,否则不允许进入自动排班
Date startpoint = (Date)datelist.get(0)
Date endpoint = (Date)datelist.get(datelist.size()-1)
//只排endpoint至enddate之间的明细
Date start_go = TimeFormat.getDateAfter(endpoint, 0, 0, 1, 0, 0, 0)
Date end_go = enddate
//构造自动排班的日期列表
ArrayList<Date>datelist_go = new ArrayList<Date>()
Date tempdate = start_go
while(!tempdate.after(end_go)){
datelist_go.add(tempdate)
tempdate = TimeFormat.getDateAfter(tempdate, 0, 0, 1, 0, 0, 0)
}
int size = datelist_go.size()
//构造模板日期列表
ArrayList<Date>modellist = new ArrayList<Date>()
Date tempmodel = startpoint
while(!tempmodel.after(endpoint)){
modellist.add(tempmodel)
tempmodel = TimeFormat.getDateAfter(tempmodel, 0, 0, 1, 0, 0, 0)
}
int modelsize = modellist.size()
//班次列表
List shiftlist = ShiftDAO.getShiftlistByDeptid(schedule.getDeptid())
//按照自动排班的日期列表逐日进行
for(int i=0i<sizei++){
int modelNo = getModelNo(i,modelsize)
String modeldate_s = TimeFormat.dateToString("yyyy-MM-dd",(Date)modellist.get(modelNo))
Date linedate = datelist_go.get(i)
for(int j=0j<shiftlist.size()j++){//再按照班次进行
Scheduleline line = new Scheduleline()
Shift shift = (Shift)shiftlist.get(j)
long shiftid = shift.getId()
Scheduleline modelline = SchedulelineDAO.getSchedulelineTrTd(id, shiftid, modeldate_s)
if(modelline!=null){//如果不为空,复制过来进行插入
line.setId(IdCreater.getId("Scheduleline"))//id不复制
line.setDatea(linedate)
line.setMembers(modelline.getMembers())
line.setLeader(modelline.getLeader())
//line.setEndtime(modelline.getEndtime())
//line.setStarttime(modelline.getStarttime())
String datea_string = TimeFormat.dateToString("yyyy-MM-dd", linedate)
String starttime_str = datea_string+" "+TimeFormat.dateToString("HH:mm", shift.getStarttime())
Date nowdaytime = TimeFormat.stringToDate("yyyy-MM-dd", datea_string)
String endStr = shift.getEndstr()
if(endStr.equals("次日")){
nowdaytime = TimeFormat.getDateAfter(nowdaytime, 0, 0, 1, 0, 0, 0)
}
String endtime_str = TimeFormat.dateToString("yyyy-MM-dd", nowdaytime)+" "+TimeFormat.dateToString("HH:mm", shift.getEndtime())
line.setStarttime(TimeFormat.stringToDate("yyyy-MM-dd HH:mm", starttime_str))
line.setEndtime(TimeFormat.stringToDate("yyyy-MM-dd HH:mm", endtime_str))
line.setShiftname(modelline.getShiftname())
line.setScheduleid(modelline.getScheduleid())
line.setShiftid(modelline.getShiftid())
SchedulelineDAO.addScheduleline(line)
}
}
}
newform.setErrormsg("排班成功!")
}
newform.getSchedule().setId_string(id_str)
ActionForward forward = detail(mapping, newform, request, response)
return forward
}
//计算第i行的排班表应该选择的模板的行号j
private static int getModelNo(int i,int modelsize){
return i%modelsize
}
//****************************自动排班结束**************************//
补充一下:中间有个TimeFormat方法,贴出来
public class TimeFormat {
//将传入的时间按照指定的格式转化成字符串返回
//注意传入的format_type必须为指定的时间格式,比如"yyyy-MM-dd HH:mm:ss"
//传入的date必须为Date型
public static String dateToString(String format_type,Date time_Date){
if(time_Date==null)return ""
SimpleDateFormat sdf = new SimpleDateFormat(format_type)
String format_time = sdf.format(time_Date)
return format_time
}
//将传入的字符串转化成指定格式的日期返回
//注意传入的format_type必须为指定的时间格式,比如"yyyy-MM-dd HH:mm:ss"
//传入的time_str必须为符合format_type格式的字符串
public static Date stringToDate(String format_type,String time_Str){
SimpleDateFormat sdf = new SimpleDateFormat(format_type)
if(time_Str.length()<format_type.length()){
if(time_Str.length()==4){
time_Str += "-00-00 00:00:00"
}
if(time_Str.length()==7){
time_Str += "-00 00:00:00"
}
if(time_Str.length()==10){
time_Str += " 00:00:00"
}
if(time_Str.length()==13){
time_Str += ":00:00"
}
if(time_Str.length()==16){
time_Str += ":00"
}
}
Date date = new Date()
try{
date = sdf.parse(time_Str)
}catch(Exception e){
e.printStackTrace()
}
return date
}
//将传入的Date型数据转化成指定格式的Date型返回
//注意传入的format_type必须为指定的时间格式,比如"yyyy-MM-dd HH:mm:ss"
//传入的time_Date必须为Date型时间
public static Date dateToDate(String format_type,Date time_Date){
String format_str = dateToString(format_type,time_Date)
Date format_date = stringToDate(format_type,format_str)
return format_date
}
public static String getCurrentDate(String format_type){
SimpleDateFormat sdf = new SimpleDateFormat(format_type)
String format_time = sdf.format(new Date())
return format_time
}
//根据传入的日期取得星期,返回星期的字符串,形如"星期二"
public static String getWeekTimeByDate(Date date){
String week = ""
String[] dayNames = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五","星期六"}
Calendar calendar = Calendar.getInstance()
calendar.setTime(date)
int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK)-1
if(dayOfWeek<0){
dayOfWeek=0
}
week = dayNames[dayOfWeek]
return week
}
//取得传入日期a年,b月,c天,d小时,e分钟,f秒以后的日期,若想得到以前的,参数为负值即可
public static Date getDateAfter(Date date,int years,int months,int days,int hours,int minutes,int seconds){
Calendar cal=Calendar.getInstance()
cal.setTime(date)
cal.add(Calendar.YEAR, years)
cal.add(Calendar.MONTH, months)
cal.add(Calendar.DATE, days)
cal.add(Calendar.HOUR, hours)
cal.add(Calendar.MINUTE, minutes)
cal.add(Calendar.SECOND, seconds)
date = cal.getTime()
return date
}
//传入一个date得到该date的月
public static int getMonth(Date date){
Calendar c = Calendar.getInstance()
c.setTime(date)
return c.get(Calendar.MONTH)+1
}
//传入一个date得到该date的月
public static int getDay(Date date){
Calendar c = Calendar.getInstance()
c.setTime(date)
return c.get(Calendar.DAY_OF_MONTH)
}
// 传入一个date得到该date的月
public static int getYear(Date date){
Calendar c = Calendar.getInstance()
c.setTime(date)
return c.get(Calendar.YEAR)
}
//取得A时间减去B时间后的毫秒数
public static long getPoorSeconds(Date a,Date b){
Calendar timea = Calendar.getInstance()
Calendar timeb = Calendar.getInstance()
timea.setTime(a)
timeb.setTime(b)
return timea.getTimeInMillis() - timeb.getTimeInMillis()
}
public static void main(String[] args) {
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)