min-water
如果一個人不知道他要駛向哪個碼頭,那么任何風都不會是順風。
BlogJava
首頁
新隨筆
聯系
聚合
管理
posts - 17, comments - 14, trackbacks - 0
student
package
gov.school.student;
public
class
Student
{
private
int
stuno;
private
String name;
private
String sex;
private
int
age;
private
int
score;
public
int
getStuno()
{
return
stuno;
}
public
void
setStuno(
int
stuno)
{
this
.stuno
=
stuno;
}
public
String getName()
{
return
name;
}
public
void
setName(String name)
{
this
.name
=
name;
}
public
String getSex()
{
return
sex;
}
public
void
setSex(String sex)
{
this
.sex
=
sex;
}
public
int
getAge()
{
return
age;
}
public
void
setAge(
int
age)
{
this
.age
=
age;
}
public
int
getScore()
{
return
score;
}
public
void
setScore(
int
score)
{
this
.score
=
score;
}
}
package
gov.school.student;
public
class
StudentServer
{
public
static
Student[] getStudent()
{
Student[] student
=
new
Student[
5
];
Student st0
=
new
Student();
st0.setAge(
20
);
st0.setName(
"
老大
"
);
st0.setScore(
95
);
st0.setSex(
"
男
"
);
st0.setStuno(
1001
);
student[
0
]
=
st0;
Student st1
=
new
Student();
st1.setAge(
21
);
st1.setName(
"
老二
"
);
st1.setScore(
92
);
st1.setSex(
"
男
"
);
st1.setStuno(
1002
);
student[
1
]
=
st1;
Student st2
=
new
Student();
st2.setAge(
22
);
st2.setName(
"
老三
"
);
st2.setScore(
76
);
st2.setSex(
"
女
"
);
st2.setStuno(
1003
);
student[
2
]
=
st2;
Student st3
=
new
Student();
st3.setAge(
28
);
st3.setName(
"
老四
"
);
st3.setScore(
60
);
st3.setSex(
"
男
"
);
st3.setStuno(
1004
);
student[
3
]
=
st3;
Student st4
=
new
Student();
st4.setAge(
20
);
st4.setName(
"
老五
"
);
st4.setScore(
85
);
st4.setSex(
"
女
"
);
st4.setStuno(
1005
);
student[
4
]
=
st4;
return
student;
}
}
package
gov.school.student;
public
class
StudentClient
{
public
static
void
main(String[] args)
{
//
TODO Auto-generated method stub
Student stud []
=
StudentServer.getStudent();
String level
=
"
a
"
;
int
q
=
0
,w
=
0
,e
=
0
,r
=
0
,t
=
0
;
for
(
int
i
=
0
;i
<
stud.length;i
++
)
{
if
(stud[i].getScore()
>
90
)
{
level
=
"
A
"
;
q
++
;
}
else
if
(stud[ i].getScore()
>
80
)
{
level
=
"
B
"
;
w
++
;
}
else
if
(stud[ i].getScore()
>
70
)
{
level
=
"
C
"
;
e
++
;
}
else
if
(stud[ i].getScore()
>
60
)
{
level
=
"
D
"
;
r
++
;
}
else
{
level
=
"
E
"
;
}
System.out.println(stud[i].getName()
+
"
"
+
stud[i].getAge()
+
"
歲,性別:
"
+
stud[i].getSex()
+
"
, 學號:
"
+
stud[i].getStuno()
+
"
, 得分:
"
+
stud[i].getScore()
+
"
, 得分等級:
"
+
level
+
"
。
"
);
}
System.out.println(
"
\n
"
+
"
等級為 A 的人數為:
"
+
q);
System.out.println(
"
等級為 B 的人數為:
"
+
w);
System.out.println(
"
等級為 C 的人數為:
"
+
e);
System.out.println(
"
等級為 D 的人數為:
"
+
r);
System.out.println(
"
等級為 E 的人數為:
"
+
t);
}
}
運行結果:
posted on 2010-10-10 18:21
Mineralwasser
閱讀(187)
評論(3)
編輯
收藏
FeedBack:
#
re: student
2010-10-10 18:33 |
Tovep
LZ寫的很好啊!
回復
更多評論
#
re: student
2010-10-10 19:53 |
迷人笑笑
很不錯?。?!前進的這么快?。『呛?-加油!!
回復
更多評論
#
re: student
2010-10-10 22:41 |
Mineralwasser
謝謝@迷人笑笑
回復
更多評論
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
Copyright ©2025 Mineralwasser Powered By:
博客園
模板提供:
滬江博客
<
2025年7月
>
日
一
二
三
四
五
六
29
30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
6
7
8
9
常用鏈接
我的隨筆
我的文章
我的評論
我的參與
最新評論
留言簿
(1)
給我留言
查看公開留言
查看私人留言
文章檔案
(21)
2010年11月 (8)
2010年10月 (13)
搜索
最新評論
1.?re: String的兩種實例化方式的區別
String a=new String();
a="hello";
為何不報錯?
--小學員
2.?re: JAVA流技術(IO編程)
re: JAVA流技術(IO編程)
--re: JAVA流技術(IO編程)
3.?re: String的兩種實例化方式的區別
講的很好。
--jjx
4.?re: String的兩種實例化方式的區別
你對string分析得很具體,到位.
--Ma
5.?re: 構造函數--公司員工信息
3@dan
--死掉
閱讀排行榜
評論排行榜
主站蜘蛛池模板:
临清市
|
浠水县
|
西藏
|
中江县
|
睢宁县
|
涿州市
|
银川市
|
康平县
|
蒙山县
|
班玛县
|
绥芬河市
|
南郑县
|
东城区
|
苍南县
|
会同县
|
新营市
|
四子王旗
|
舞阳县
|
固镇县
|
合山市
|
许昌县
|
西峡县
|
鸡西市
|
德惠市
|
子长县
|
彩票
|
微博
|
大足县
|
竹山县
|
开原市
|
城固县
|
绍兴市
|
久治县
|
休宁县
|
澜沧
|
东辽县
|
都昌县
|
镇平县
|
安化县
|
闵行区
|
余江县
|