帮你写一个,自己加入到网站中去:
1,建立库,在原来的库上加一个表也可以,现在假设新建一个名叫book的库,ACCSEE型,表名叫Test_book
库名=book
表(Test_book):id(自动编号),bookdate(日期,文本50),booktime(时间,文本50),bookname(课程名,文本50),BookClass(数字,课程分期)
2,conn.asp//库链接及通用函数页
将下面的代码保存为conn.asp
<%
dim conn,connstr,db,BookClassName
BookClassName = "执业医师" '课程类名称,请修改
db="book.mdb"
ConnStr = "Provider = Microsoft.Jet.OLEDB.4.0Data Source = " & Server.MapPath(db)
On Error Resume Next
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open ConnStr
If Err Then
err.Clear
Set Conn = Nothing
Response.Write "DATABASE IS ERR!"
Response.End
End If
Function Showpage(totalnumber,maxperpage,filename,cpage)
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
Response.Write "总课程"&totalnumber&",每页"&maxperpage&"/第"&cpage&"页/共"&n&"页"& VbCrLf
if cpage<2 then
Response.Write " 首页 上页 "& VbCrLf
else
Response.Write " <a href="&filename&"?page=1>首页</a> "& VbCrLf
Response.Write "<a href="&filename&"?page="&cpage-1&">上页</a> "& VbCrLf
end if
if n-cpage<1 then
Response.Write "下页 末页"& VbCrLf
else
Response.Write "<a href="&filename&"?page="&cpage+1&">下页</a> "& VbCrLf
Response.Write "<a href="&filename&"?page="&n&">末页</a>"& VbCrLf
end if
End function
Sub BookCss()
Response.Write "<style type=""text/css"">"& VbCrLf
Response.Write "BODY {margin:0Padding:0COLOR:#444font-family:宋体font-size: 9pt }"& VbCrLf
Response.Write "TD { COLOR: #444 font-family:Verdanafont-size:9pt}"& VbCrLf
Response.Write "form{margin:5,0,0,0}"& VbCrLf
Response.Write "input {border-width: 1 border-color: #000000 background-color: #efefef font-family: 宋体 font-size: 9pt COLOR:#333line-height:14px}"& VbCrLf
Response.Write "textarea {border-width: 1 border-color: #000000 background-color: #efefef font-family: 宋体 font-size: 9pt}"& VbCrLf
Response.Write "select {border-width: 1 border-color: #000 background-color: #eee font-family: 宋体 font-size: 9pt}"& VbCrLf
Response.Write "A {COLOR: #444font-family:Verdana}"& VbCrLf
Response.Write "A:link {color:0000aaTEXT-DECORATION: none }"& VbCrLf
Response.Write "A:visited {color:0000aaTEXT-DECORATION: none }"& VbCrLf
Response.Write "A:hover {COLOR: #ff2200TEXT-DECORATION: none }"& VbCrLf
Response.Write ".headdiv{height:105pxwidth:100%margin:0padding:10background:#f8f8f8}"& VbCrLf
Response.Write ".Linediv1{border-bottom: #ccc 2px solidwidth:100%margin:0padding:0line-heignt:1pxheight:1px}"& VbCrLf
Response.Write ".Linediv{border-top: #999 1px solidwidth:100%margin:0padding:0line-heignt:1pxheight:1px}"& VbCrLf
Response.Write ".Listdiv{width:550pxpadding:10background:#eee}"& VbCrLf
Response.Write ".cpagediv{margin-top:5pxpadding-left:10pxcolor:#999}"& VbCrLf
Response.Write ".adddiv{width:100%margin-bottom:5pxpadding-left:60px}"& VbCrLf
Response.Write ".li1{width:250pxline-height:16pxfont-size:12pxlist-style:nonecolor:069}"& VbCrLf
Response.Write "</style>"& VbCrLf
End Sub
%>
3.BookMain.asp//课程管理,仅提供添加和删除,若要修改功能请联系。
将下面的代码保存为BookMain.asp,和conn.asp在同一目录
<!--#include file="Conn.asp"-->
<%
Dim FileName
FileName = "BookMain.asp"
Call Main()
Conn.Close:Set Conn = Nothing
Sub Main()
Call BookCss()
Select Case Request("action")
Case "DelBook"
Call DelBook(Trim(Request("Id")),Trim(Request("page")))
Case "AddBook"
Call BookSave()
Call BookList()
Case Else
Call UpdateMain()
Call BookList()
End Select
Conn.Close:Set Conn = Nothing
End Sub
Sub UpdateMain()
Dim ClassNum
ClassNum = 1
Set Rs = Conn.execute("Select Top 1 Bookclass From Test_Book Order By Id Desc")
If Not(rs.bof and rs.eof) Then ClassNum = Rs(0)+1
Rs.Close:Set Rs = Nothing
Response.Write "<DIV class=headdiv>"& VbCrLf
Response.Write "<div><b>添加新课程</b></div>"& VbCrLf
Response.Write "<form method=POST action=""?action=AddBook"" name=form1>"& VbCrLf
Response.Write "<div>"& VbCrLf
Response.Write "课程名称:<input type=""text"" name=""bookname"" value="""" size=20>"& VbCrLf
Response.Write "课程期数:<input type=""text"" name=""BookClass"" value="""&ClassNum&""" size=5>填写数字</div>"& VbCrLf
Response.Write "<div>"& VbCrLf
Response.Write "开课日期:<input type=""text"" name=""Bookdate"" value="""" size=20>"& VbCrLf
Response.Write "开课时间:<input type=""text"" name=""booktime"" value="""" size=20></div>"& VbCrLf
Response.Write "<div class=adddiv><input type=""submit"" value="" 确定添加 "" name=""button1""></div>"& VbCrLf
Response.Write "</form>"& VbCrLf
Response.Write "</DIV>"& VbCrLf
Response.Write "<DIV class=linediv></DIV>"& VbCrLf
End Sub
Sub BookSave()
Dim BookName,BookClass,BookDate,BookTime,BMark
BookClass = Trim(Request("BookClass"))
If Isnumeric(BookClass) = False Then Exit Sub
BookClass = Cint(BookClass)
BookName = Trim(Request("BookName"))
BookDate = Trim(Request("BookDate"))
BookTime = Trim(Request("BookTime"))
Conn.Execute("insert Into Test_Book(BookName,BookClass,BookDate,BookTime)Values('"&BookName&"','"&BookClass&"','"&BookDate&"','"&BookTime&"')")
Response.Write "<DIV class=headdiv>"& VbCrLf
Response.Write "<div><b>课程添加成功!</b></div>"& VbCrLf
Response.Write "<form method=POST action= name=form2>"& VbCrLf
Response.Write "<div>第"&BookClass&"期课程,"&BookName&","&BookDate&Booktime&"开课。<a href=""?action=Main"">>>继续添加</a>"& VbCrLf
Response.Write "</div>"& VbCrLf
Response.Write "</form>"& VbCrLf
Response.Write "</DIV>"& VbCrLf
Response.Write "<DIV class=linediv>&nbsp</DIV>"& VbCrLf
End Sub
Sub BookList()
Dim MaxPage,totalPut,cpage,Infonum,k,i
cpage = 1
If Request("page")<>"" then
If Isnumeric(Request("page")) = False Then
cpage = 1
Else
cpage=Cint(Request("page"))
End If
End If
Infonum = 1
MaxPage = 15
Response.Write "<DIV Style=""width=:100%margin:0"">"& VbCrLf
Response.Write "<div> <b>课程管理</b></div>"& VbCrLf
Response.Write "<div class=Listdiv>"& VbCrLf
Set Rs = Server.CreateObject("ADODB.RecordSet")
Sql = "Select * From Test_book Order By Id Desc"
Rs.Open Sql,Conn,1,1
If Rs.eof and rs.bof then
Response.write "<p>暂时没有任何课程。</p>" & VbCrLf
Else
i=0
totalPut=Rs.Recordcount
If cpage<1 then cpage=1
If (cpage-1)*MaxPage>totalput then
If (totalPut mod MaxPage)=0 then
cpage= totalPut \ MaxPage
Else
cpage= totalPut \ MaxPage + 1
End If
End if
If cpage<>1 then
If (cpage-1)*MaxPage<totalPut then
Rs.move (cpage-1)*MaxPage
BMark = Rs.bookmark
Else
cpage = 1
End If
End If
InfoNum = totalPut-(cpage-1)*MaxPage
k = 4 - len(InfoNum)
Do while k>0
k = k - 1
InfoNum = "0" & InfoNum
loop
Response.Write "<div class=cpagediv>"& VbCrLf
showpage totalput,MaxPage,filename,cpage
Response.Write "</div>"& VbCrLf
Response.Write "<table width=540 border=0 cellspacing=2 cellpadding=0>"& VbCrLf
Response.Write "<tr align=center bgcolor=""#C2CCE2"">"& VbCrLf
Response.Write "<td width=""10%"" height=24>序号</td>"& VbCrLf
Response.Write "<td width=""20%"">日期</td>"& VbCrLf
Response.Write "<td width=""20%"">时间</td>"& VbCrLf
Response.Write "<td width=""30%"">课程名称</td>"& VbCrLf
Response.Write "<td width=""10%"">期数</td>"& VbCrLf
Response.Write "<td width=""10%""> *** 作</td>"& VbCrLf
Response.Write "</tr>"& VbCrLf
Do while not Rs.eof and maxpage>0
i = i+1
Response.Write "<tr align=center bgcolor=""DFE8EE"">"& VbCrLf
Response.Write "<td height=24>"&InfoNum&"</td>"& VbCrLf
Response.Write "<td>"&rs(1)&"</td>"& VbCrLf
Response.Write "<td>"&rs(2)&"</td>"& VbCrLf
Response.Write "<td>"&rs(3)&"</td>"& VbCrLf
Response.Write "<td>"&rs(4)&"期</td>"& VbCrLf
Response.Write "<td><a href=0.asp?Id="&rs(0)&"&action=DelBook onClick=""return confirm('警告:您的 *** 作不可恢复,确定删除选定的程序记录? ')"">删除</a></td>"& VbCrLf
Response.Write "</tr>"& VbCrLf
If i >= MaxPage Then Exit Do
Rs.movenext
InfoNum = InfoNum-1
k = 4 - len(InfoNum)
Do while k>0
k = k - 1
InfoNum = "0" & InfoNum
loop
Loop
Response.Write "</table>"& VbCrLf
End If
Rs.Close:Set Rs = Nothing
Response.Write "<div>"& VbCrLf
Response.Write "</DIV>"& VbCrLf
End Sub
Sub DelBook(Id,page)
Conn.Execute("Delete * From Test_Book where Id="&Id)
Response.redirect "0.asp?page="&page
End Sub
%>
4.课程显示页面:Showbook.asp
将下面的代码存为Showbook.asp,如果不和conn.asp不在同一目录,注意修改conn.asp路径:
我晕,好象是字数超限了,几次贴不上来,就贴到这里,还有一页HI我,给张图片看看。
写一个课程表计算程序java
import java.util.ArrayList
import java.util.List
import javax.swing.JOptionPane
class Course {
private String course
private String unit
private String grade
private String score
public String getCourse() {
return this.course
}
public void setCourse(String course) {
this.course = course
}
public String getUnit() {
return this.unit
}
public void setUnit(String unit) {
this.unit = unit
}
public String getGrade() {
return this.grade
}
public void setGrade(String grade) {
this.grade = grade
}
public String getScore() {
return this.score
}
public void setScore(String score) {
this.score = score
}
}
class GPAInfo {
private String name
private List<Course>courseInfo
private String gpa
public String getName() {
return this.name
}
public void setName(String name) {
this.name = name
}
public List<Course>getCourseInfo() {
return this.courseInfo
}
public void setCourseInfo(List<Course>courseInfo) {
this.courseInfo = courseInfo
}
public String getGpa() {
return this.gpa
}
public void setGpa(String gpa) {
this.gpa = gpa
}
}
public class GPA {
public static void main(String[] args) {
// String hasNextStudent = "y"
String hasNextCourse = "y"
// List<GPAInfo>gpaInfolist = new ArrayList<GPAInfo>()
// while((hasNextStudent != null) &&"y".equals(hasNextStudent.toLowerCase())) {
GPAInfo gpaInfo = new GPAInfo()
String name = JOptionPane.showInputDialog("enter a name")
gpaInfo.setName(name)
List<Course>courselist = new ArrayList<Course>()
while ((hasNextCourse != null) &&"y".equals(hasNextCourse.toLowerCase())) {
Course course = new Course()
String courseName = JOptionPane.showInputDialog(" What class do you have?")
course.setCourse(courseName)
String unit = JOptionPane.showInputDialog(" Enter the units you get")
course.setUnit(unit)
String grade = JOptionPane.showInputDialog(" Grade you get?")
course.setGrade(grade)
course.setScore(String.valueOf(getScore(grade.toCharArray()[0])))
courselist.add(course)
hasNextCourse = JOptionPane.showInputDialog(" other class? Yes or no")
}// while has next course
hasNextCourse = "y"
gpaInfo.setCourseInfo(courselist)
gpaInfo.setGpa(getGpa(courselist))
// gpaInfolist.add(gpaInfo)
// hasNextStudent = JOptionPane.showInputDialog(" other student? Yes or no")
// }// while has next student
String output = ""
// for (GPAInfo gpaInfo : gpaInfolist) {
output += "名字:" + gpaInfo.getName() + "\n"
output += "课程 学分 成绩" + "\n"
// List<Course>courselist = gpaInfo.getCourseInfo()
for (Course course : courselist) {
output += course.getCourse() + " " + course.getUnit() + " " + course.getScore() + "\n"
}
output += "平均点数GPA " + gpaInfo.getGpa() + "\n\n"
// }
System.out.println(output)
JOptionPane.showMessageDialog(null, output)
System.exit(-1)
}
private static String getGpa(List<Course>courselist) {
double avg = 0
int totalScore = 0
int totalUnit = 0
for (Course course : courselist) {
totalUnit += Integer.parseInt(course.getScore())
totalScore += Integer.parseInt(course.getUnit()) * Integer.parseInt(course.getScore())
}
if (totalUnit != 0) {
avg = totalScore / totalUnit
}
if (avg >4) {
avg = 4
}
return String.valueOf(avg)
}
private static int getScore(char score) {
int point
score = Character.toUpperCase(score)
switch (score) {
case 'A':
point = 4
break
case 'B':
point = 3
break
case 'C':
point = 2
break
case 'D':
point = 1
break
default:
point = 0
break
}
return point
}
}
怎么制作一个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编写课程表cource 包含: 3个成员变量:课程编写(cnumber)、课程名(name)和学分(cunit)
要实现的什么说具体点
class cource{
int cnumber
String name
float cunit
}
java学习有没有课程表
课程表没有,这是朋友在叩丁狼学习的课程大纲,可以给你看看参考一下
第一阶段Java基础阶段
第二阶段、JavaWeb阶段
第三阶段、Web前端阶段
第四阶段、高级框架和技术阶段
第五阶段、互联网高薪技术阶段
第六阶段、七大实战项目(项目部分)阶段
用java实现课程表
你只需要一个选课表,存学生ID,课程ID,所有学生的选课都是这一个表,每次选课加一条数据,展现的时候根据用户去查选课表就行了
用Java做一个课程表
创建2个对象 *** ,判断差异,如果存在差异就将那条数据保存为文件内容
基本就这么简单
用java编写课程表
可以用GUI画个8X7的宫格
用Java怎样实现课表代码有周次
课表数据时存储于数据库中的吗?
/**
* 获取一周的时间 *** (从周一到周日)
* @param weekNum -1:上周;0:本周;1:下周
*/
public static List<Date>getWeekDates(int weekNum){
List<Date>list = new ArrayList<Date>()
Calendar cal = Calendar.getInstance()
// 获取指定下几个星期
cal.add(Calendar.DAY_OF_WEEK, weekNum * 7)
cal.setFirstDayOfWeek(Calendar.MONDAY)
cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY)
list.add(cal.getTime())
for(int i = 0i <6i++){
cal.add(Calendar.DAY_OF_WEEK, 1)
list.add(cal.getTime())
}
return list
}
这个是获取这一周时间的代码 ,之后用下面的代码获取周一到周日的日期
List<Date>ds = DateUtil.getNowWeekDates(weekNum)
ds.get(0)//周一
ds.get(6)//周日
用这两个时间到数据库中进行范围查询,之后的你应该明白了吧
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)