后台:ssh框架,不用框架的话,单纯地用jsp
+
servlet也可以。
前台:html
+
css
+
js
+
jquery
数据库:掌握sql语言的编写,数据库的连接。复杂的项目还需要用到存储过程。
这里有一个类实现学生学号,数学,语文,英语成绩录入
并且计算平均成绩,按照平均成绩高低输出信息
你可以改改!
//实现简单的学生信息输入输出和初步的成绩排序
public
class
student
{
private
int
id
//学号
private
int
mathscore
//数学成绩
private
int
chinscore
//语文成绩
private
int
forescore
//外语成绩
public
student()
{
id
=
0
mathscore
=
0
chinscore
=
0
forescore
=
0
}
public
student(int
newid,
int
newmathscore,
int
newchinsvore,
int
newforescore)
{
id
=
newid
mathscore
=
newmathscore
chinscore
=
newchinsvore
forescore
=
newforescore
}
public
double
getaveragescore()
{
//求平均成绩
double
averagescore
=
((double)
mathscore
+
chinscore
+
forescore)
/
3
return
averagescore
}
public
void
output(student
student)
{
//输出对象的内容
system.out.println("
"
+
student.id
+
"
"
+
student.mathscore
+
"
"
+
student.chinscore
+
"
"
+
student.forescore
+
"
"
+
student.getaveragescore())
}
public
int
max(student
a[],
int
n)
{
//student类对象数组的前n项中的成绩最大值的索引
int
position
=
0
for
(int
i
=
1
i
<
n
i++)
{
if
(a[i].getaveragescore()
>
a[position].getaveragescore())
{
//比较平均成绩
position
=
i
}
}
return
position
}
public
void
selectsort(student
a[])
{
//student类对象数组的选择排序
for
(int
n
=
a.length
n
>
1
n--)
{
int
i
=
max(a,
n)
student
temp
=
a[i]
a[i]
=
a[n
-
1]
a[n
-
1]
=
temp
}
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)