首先先解壓文件,然後是相應的文件導入到相應的PHP源碼,看看有沒有安裝手冊,如果沒有,再找有沒有那個Install.php的文件了,如果有的話,就直接輸出www/後的文件路徑,進入頁面以後,就是一步步提示安裝,若是沒有找到資料庫文件夾,就在PHPMyAdmin中建一個資料庫名,裡面的表可以不用建,這樣安裝就沒問題了。 或者還有一種就是那個不用管資料庫,直接找到Install.php,然後直接安裝就行了,資料庫是自動生成的,比較簡單。 或者是下載的源代碼,其中有配置文件,只要把把配置文件調好,其中包括文件保存路徑,用戶名,密碼,網站名......等等,點擊保存就好了。 有手冊的話就仔細閱讀手冊,要注意有些講的是Lunix配置,不用去管它。 還有就是要有耐心啊,是在不會用 就行了。
❷ 求一個用數據結構和c語言編的考試報名管理系統的源代碼
可以藉助Bai Hi示意我們
有機會可能完成你所面臨的任務
具體的要求也可能示意我們
ES:\\
❸ 學生信息管理系統最簡單源代碼。
方法一:
1、創建一個c語言項目。然後右鍵頭文件,創建一個Stu的頭文件。
❹ 在線報名系統源碼
可以試試易查分,基本上報名系統具備的功能在易查分都可以實現,3分鍾左右就可以生成,不用技術代碼什麼的,只要把需要統計的內容,比如「報名姓名」「報名考號」「報名密碼」等,做成excel電子表格,上傳到易查分,就可以生成,手機和電腦都可以查,你可以試試~
下圖是利用易查分生成的報名系統截圖:
❺ 學生管理系統源代碼c++
#include <iostream.h>
#include <string.h>
#include "h1.h"
void menu();
void clear()
{
cin.clear();
cin.ignore();
}
void stu::init_name_grade() //輸入學生姓名、班級
{
cout<<"請輸入學生姓名:";
cin>>name;
clear();
cout<<"請輸入學生班級號:";
cin>>grade;
clear();
}
void stu::init_first() //輸入學生第一學期成績
{
cout<<"學生"<<name<<"第一學期成績"<<endl;
cout<<"請輸入英語成績:";
cin>>first.english;
clear();
cout<<"請輸入數學成績:";
cin>>first.math;
clear();
first.total=first.english+first.math;
first.aver=first.total/2;
}
void stu::init_second() //輸入學生第二學期成績
{
cout<<"學生"<<name<<"第二學期成績"<<endl;
cout<<"請輸入英語成績:";
cin>>second.english;
clear();
cout<<"請輸入數學成績:";
cin>>second.math;
clear();
second.total=second.english+second.math;
second.aver=second.total/2;
}
void stu::show_first() //顯示學生第一學期成績
{
cout<<"學生姓名:"<<name<<endl;
cout<<"學生班級:"<<grade<<endl;
cout<<"學生第一學期英語成績:"<<first.english<<endl;
cout<<"學生第一學期數學成績:"<<first.math<<endl;
cout<<"學生第一學期總成績:"<<first.total<<endl;
cout<<"學生第一學期平均成績:"<<first.aver<<endl;
}
void stu::show_second() //顯示學生第二學期成績
{
cout<<"學生姓名:"<<name<<endl;
cout<<"學生班級:"<<grade<<endl;
cout<<"學生第二學期英語成績:"<<second.english<<endl;
cout<<"學生第二學期數學成績:"<<second.math<<endl;
cout<<"學生第二學期總成績:"<<second.total<<endl;
cout<<"學生第二學期平均成績:"<<second.aver<<endl;
}
void stu::show_grade() //顯示學生所有學期成績
{
cout<<"學生姓名:"<<name<<endl;
cout<<"學生班級:"<<grade<<endl;
cout<<"學生第一學期英語成績:"<<first.english<<endl;
cout<<"學生第一學期數學成績:"<<first.math<<endl;
cout<<"學生第一學期總成績:"<<first.total<<endl;
cout<<"學生第一學期平均成績:"<<first.aver<<endl;
cout<<"學生第二學期英語成績:"<<second.english<<endl;
cout<<"學生第二學期數學成績:"<<second.math<<endl;
cout<<"學生第二學期總成績:"<<second.total<<endl;
cout<<"學生第二學期平均成績:"<<second.aver<<endl;
}
stu_info::stu_info() //stu_info的構造函數
{
num=0;
}
void stu_info::add_name_grade() //添加學生信息(班級、姓名)到數組中
{
int choose;
do
{
per[num].init_name_grade();
num++;
cout<<"繼續輸入學生信息嗎?(0:退出,任意數字鍵繼續...)";
cin>>choose;
clear();
}while(choose!=0);
}
void stu_info::add_first(int gra) //添加第一學期成績
{
for(int i=0;i<num;i++)
{
if(per[i].grade==gra)
{
per[i].init_first();
}
}
}
void stu_info::add_second(int gra) //添加第二學期成績
{
for(int i=0;i<num;i++)
{
if(per[i].grade==gra)
{
per[i].init_second();
}
}
}
void stu_info::query_aver(int gra,int term) //按班級、學期及平均分排序顯示學生成績
{
stu temp[100];
stu t;
int sum=0;
for(int i=0;i<num;i++)
{
if(per[i].grade==gra)
{
temp[sum]=per[i];
sum++;
}
}
for(int j=0;j<sum-1;j++)
{
for(int k=sum-1;k>j;k--)
{
if(term==1)
{
if(temp[k].first.aver>temp[k-1].first.aver)
{
t=temp[k];
temp[k]=temp[k-1];
temp[k-1]=t;
}
}
else if(term==2)
{
if(temp[k].second.aver>temp[k-1].second.aver)
{
t=temp[k];
temp[k]=temp[k-1];
temp[k-1]=t;
}
}
else
{
cout<<"該學期不存在!"<<endl;
return;
}
}
}
for( i=0;i<sum;i++)
{
if(term==1)
{
temp[i].show_first();
}
else
{
temp[i].show_second();
}
}
}
void stu_info::modify(int gra,char name[10]) //按班級、姓名查詢學生信息並修改學生信息
{
for(int i=0;i<num;i++)
{
if(per[i].grade==gra&&strcmp(per[i].name,name)==0)
{
per[i].init_name_grade();
per[i].init_first();
per[i].init_second();
return;
}
else
{
cout<<"該學生不存在!"<<endl;
}
}
}
void stu_info::query(int gra,char name[10]) //按班級、姓名查詢學生信息並輸出
{
for(int i=0;i<num;i++)
{
if(per[i].grade==gra&&strcmp(per[i].name,name)==0)
{
per[i].show_grade();
return;
}
else
{
cout<<"該學生不存在!"<<endl;
}
}
}
void stu_info::query_grade(int gra) //按班級輸出該班全部學生成績
{
cout<<gra<<"班級學生的成績如下:"<<endl;
for(int i=0;i<num;i++)
{
if(per[i].grade==gra)
{
per[i].show_grade();
}
}
}
void stu_info::show_fail(int grade,int term,int course)
{
cout<<"不及格名單如下:"<<endl;
for(int i=0;i<num;i++)
{
if(per[i].grade==grade)
{
if(term==1)
{
if(course==1)
{
if(per[i].first.english<60)
{
cout<<per[i].name<<endl;
}
}else if(course==2)
{
if(per[i].first.math<60)
{
cout<<per[i].name<<endl;
}
}
}
else if(term==2)
{
if(course==1)
{
if(per[i].second.english<60)
{
cout<<per[i].name<<endl;
}
}else if(course==2)
{
if(per[i].second.math<60)
{
cout<<per[i].name<<endl;
}
}
}
else
{
cout<<"該學期不存在!"<<endl;
return;
}
}
}
}
void main()
{
stu_info people;
int grade;
int term;
int choose;
int course;
char name[10];
while(1)
{
menu();
cin>>choose;
clear();
switch(choose)
{
case 1:
people.add_name_grade();break;
case 2:
cout<<"請輸入班級號:";
cin>>grade;
clear();
cout<<"請輸入學期:";
cin>>term;
clear();
if(term==1)
people.add_first(grade);
else
people.add_second(grade);
break;
case 3:
cout<<"請輸入班級號:";
cin>>grade;
clear();
cout<<"請輸入學生姓名:";
cin>>name;
clear();
people.modify(grade,name);
break;
case 4:
cout<<"請輸入班級號:";
cin>>grade;
clear();
cout<<"請輸入學期:";
cin>>term;
clear();
people.query_aver(grade,term);
break;
case 5:
cout<<"請輸入班級號:";
cin>>grade;
clear();
people.query_grade(grade);
break;
case 6:
cout<<"請輸入班級號:";
cin>>grade;
clear();
cout<<"請輸入學期:";
cin>>term;
clear();
cout<<"請輸入課程號(1:english,2:math):";
cin>>course;
people.show_fail(grade,term,course);
break;
case 7:
cout<<"請輸入班級號:";
cin>>grade;
clear();
cout<<"請輸入學生姓名:";
cin>>name;
clear();
people.query(grade,name);
break;
case 8:return;
default:cout<<"選擇錯誤,請重新選擇!"<<endl;
}
}
}
void menu()
{
cout<<" 請選擇操作"<<endl;
cout<<"-------------------------------------------------------------"<<endl;
cout<<" 1、輸入學生姓名、班級"<<endl;
cout<<" 2、按學期、班級錄入學生成績"<<endl;
cout<<" 3、修改學生成績"<<endl;
cout<<" 4、按班級平均分對學生成績排序"<<endl;
cout<<" 5、按班級輸出學生的成績單"<<endl;
cout<<" 6、按科目輸出不及格學生名單"<<endl;
cout<<" 7、查詢學生成績單"<<endl;
cout<<" 8、退出系統"<<endl;
}
這上面是實現功能,下面是類的定義和聲明 希望對你有用
struct term
{
int english;
int math;
int aver;
int total;
};
class stu
{
char name[10];
int grade;
struct term first;
struct term second;
public:
friend class stu_info;
void init_name_grade();
void init_first();
void init_second();
void show_grade();
void show_first();
void show_second();
};
class stu_info
{
stu per[100];
int num;
public:
stu_info();
void add_name_grade();
void add_first(int gra);
void add_second(int gra);
void query_aver(int gra,int term);
void modify(int gra,char name[10]);
void query(int gra,char name[10]);
void query_grade(int gra);
void show_fail(int grade,int term,int course);
};
❻ 求在線報名系統源代碼
http://www.pangue.com/down.html
盤古教育通用報名系統是盤古教育網根據目前網上各種報名方式,綜合各種行業開發出來的一套能夠適用於學校,企業,培訓機構的在線電子報名系統!
一、自定義無限級報名學科分類;
二、設置報名者在報名時候必須提交的信息;
三、在線郵件/QQ回復報名者;
四、並可以將任意報名學科/類型的報名者信息導出到本地電腦,讓你不上網也可以隨時隨時察看;
五、強大的系統還原功能,讓你的系統能夠還原到任意還原點,是你系統數據安全的有力保證!
v2.0升級說明:
增加了免費用戶發郵件的功能,3種郵件發送方式
Setup程序自動安裝系統。
❼ 學生管理系統php源碼誰有
php學生管理系統源碼,供大家參考,具體內容如下
功能:
1.添加/刪除/修改
2.數據存儲.
界面分布:
index.php
--->主界面
add.php --->stu添加
action ---> sql中add/del/update
(處理html表單-->mysql的數據存儲 && 頁面跳轉)
edit.php --->stu修改
menu.php
-->首頁
1. index.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>學生信息管理</title>
<script>
function doDel(id) {
if(confirm('確認刪除?')) {
window.location='action.php?action=del&id='+id;
}
}
</script>
</head>
<body>
<center>
<?php
include ("menu.php");
?>
<h3>瀏覽學生信息</h3>
<table width="500" border="1">
<tr>
<th>ID</th>
<th>姓名</th>
<th>性別</th>
<th>年齡</th>
<th>班級</th>
<th>操作</th>
</tr>
<?php
// 1. 鏈接資料庫
try{
$pdo = new PDO("uri:mysqlPdo.ini","root","1");
}catch (PDOException $e) {
die('connection failed'.$e->getMessage());
}
//2.執行sql
$sql_select = "select * from stu";
//3.data 解析
foreach ( $pdo->query($sql_select) as $row) {
echo "<tr>";
echo "<th>{$row['id']} </th>";
echo "<th>{$row['name']}</th>";
echo "<th>{$row['sex']} </th>";
echo "<th>{$row['age']} </th>";
echo "<th>{$row['classid']}</th>";
echo "<td>
<a href='edit.php?id={$row['id']}'>修改</a>
<a href='javascript:void(0);' onclick='doDel({$row['id']})'>刪除</a>
</td>";
echo "</tr>";
}
?>
</table>
</center>
</body>
</html>
2. add.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>學生管理系統</title>
</head>
<body>
<center>
<?php include ('menu.php'); ?>
<h3>增加學生信息</h3>
<form action="action.php?action=add" method="post">
<table>
<tr>
<td>姓名</td>
<td><input type="text" name="name"></td>
</tr>
<tr>
<td>年齡</td>
<td><input type="text" name="age"></td>
</tr>
<tr>
<td>性別</td>
<td><input type="radio" name="sex" value="男">男</td>
<td><input type="radio" name="sex" value="女">女</td>
</tr>
<tr>
<td>班級</td>
<td><input type="text" name="classid"></td>
</tr>
<tr>
<!-- <td> </td>-->
<td><a href="index.php">返回</td>
<td><input type="submit" value="添加"></td>
<td><input type="reset" value="重置"></td>
</tr>
</table>
</form>
</center>
</body>
</html>
3. action.php
<?php
/**
* Created by PhpStorm.
* User: hyh
* Date: 16-7-7
* Time: 下午9:37
*/
//1. 鏈接資料庫
try{
$pdo = new PDO("uri:mysqlPdo.ini","root","1");
}catch (PDOException $e) {
// echo 'Connection failed: ' . $e->getMessage();
die('connection failed'.$e->getMessage());
}
//2.action 的值做對操作
switch ($_GET['action']){
case 'add'://add
$name = $_POST['name'];
$sex = $_POST['sex'];
$age = $_POST['age'];
$classid = $_POST['classid'];
$sql = "insert into stu (name, sex, age, classid) values ('{$name}', '{$sex}','{$age}','{$classid}')";
$rw = $pdo->exec($sql);
if ($rw > 0){
echo "<script>alter('添加成功');</script>";
}else{
echo "<script>alter('添加失敗');</script>";
}
header('Location: index.php');
break;
case 'del'://get
$id = $_GET['id'];
$sql = "delete from stu where id={$id}";
$rw = $pdo->exec($sql);
if ($rw > 0){
echo "<script>alter('刪除成功');</script>";
}else{
echo "<script>alter('刪除失敗');</script>";
}
header('Location: index.php');
break;
case 'edit'://post
$id = $_POST['id'];
$name = $_POST['name'];
$age = $_POST['age'];
$classid = $_POST['classid'];
$sex = $_POST['sex'];
// echo $id, $age, $age, $name;
$sql = "update stu set name='{$name}', age={$age},sex='{$sex}',classid={$classid} where id={$id};";
// $sql = "update myapp.stu set name='jike',sex='女', age=24,classid=44 where id=17";
print $sql;
$rw = $pdo->exec($sql);
if ($rw > 0){
echo "<script>alter('更新成功');</script>";
}else{
echo "<script>alter('更新失敗');</script>";
}
header('Location: index.php');
break;
default:
header('Location: index.php');
break;
}
4.edit.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>學生管理系統</title>
</head>
<body>
<center>
<?php include ('menu.php');
//1. 鏈接資料庫
try{
$pdo = new PDO("uri:mysqlPdo.ini","root","1");
}catch (PDOException $e) {
die('connection failed'.$e->getMessage());
}
//2.執行sql
$sql_select = "select * from stu where id={$_GET['id']}";
$stmt = $pdo->query($sql_select);
if ($stmt->rowCount() >0) {
$stu = $stmt->fetch(PDO::FETCH_ASSOC); // 解析數據
}else{
die("no have this id:{$_GET['id']}");
}
?>
<h3>修改學生信息</h3>
<form action="action.php?action=edit" method="post">
<input type="hidden" name="id" value="<?php echo $stu['id'];?>">
<table>
<tr>
<td>姓名</td>
<td><input type="text" name="name" value="<?php echo $stu['name'];?>"></td>
</tr>
<tr>
<td>年齡</td>
<td><input type="text" name="age" value="<?php echo $stu['age'];?>"></td>
</tr>
<tr>
<td>性別</td>
<td>
<input type="radio" name="sex" value="男" <?php echo ($stu['sex'] == "男")? "checked":"";?> >男
</td>
<td>
<input type="radio" name="sex" value="女" <?php echo ($stu['sex'] == "女")? "checked":"";?> >女
</td>
</tr>
<tr>
<td>班級</td>
<td><input type="text" name="classid" value="<?php echo $stu['classid']?>"></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" value="更新"></td>
<td><input type="reset" value="重置"></td>
</tr>
</table>
</form>
</center>
<?php
?>
</body>
</html>
5. menu.php
<!DOCTYPE html>
<html lang="en">
<body>
<h2>學生管理系統</h2>
<a href="index.php"> 瀏覽學生</a>
<a href="add.php"> 添加學生</a>
<hr>
</body>
</html>
❽ 學生考試管理系統,JAva源代碼
//主類EnglishTest——
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class EnglishTest extends JFrame
{
TestArea testPanel=null;
Container con=null;
public EnglishTest()
{
super("模擬考試");
testPanel=new TestArea();
con=getContentPane();
con.add(testPanel,BorderLayout.CENTER);
addWindowListener(new WindowAdapter()
{ public void windowClosing(WindowEvent e)
{ System.exit(0);
}
});
setVisible(true);
setBounds(60,40,660,460);
con.validate();
validate();
}
public static void main(String args[])
{
new EnglishTest();
}
}
//讀取試題 ReadTestquestion
import java.io.*;
import java.util.*;
public class ReadTestquestion
{ String filename="",
correctAnswer="",
testContent="" ,
selection="" ;
int score=0;
long time=0;
boolean 完成考試=false;
File f=null;
FileReader in=null;
BufferedReader 讀取=null;
public void setFilename(String name)
{ filename=name;
score=0;
selection="";
try {
if(in!=null&&讀取!=null)
{
in.close();
讀取.close();
}
f=new File(filename);
in=new FileReader(f);
讀取=new BufferedReader(in);
correctAnswer=(讀取.readLine()).trim();
String temp=(讀取.readLine()).trim() ;
StringTokenizer token=new StringTokenizer(temp,":");
int hour=Integer.parseInt(token.nextToken()) ;
int minute=Integer.parseInt(token.nextToken());
int second=Integer.parseInt(token.nextToken());
time=1000*(second+minute*60+hour*60*60);
}
catch(Exception e)
{
testContent="沒有選擇試題";
}
}
public String getFilename()
{
return filename;
}
public long getTime()
{
return time;
}
public void set完成考試(boolean b)
{
完成考試=b;
}
public boolean get完成考試()
{
return 完成考試;
}
public String getTestContent()
{ try {
String s=null;
StringBuffer temp=new StringBuffer();
if(讀取!=null)
{
while((s=讀取.readLine())!=null)
{
if(s.startsWith("**"))
break;
temp.append("\n"+s);
if(s.startsWith("endend"))
{
in.close();
讀取.close();
完成考試=true;
}
}
testContent=new String(temp);
}
else
{
testContent=new String("沒有選擇試題");
}
}
catch(Exception e)
{
testContent="試題內容為空,考試結束!!";
}
return testContent;
}
public void setSelection(String s)
{
selection=selection+s;
}
public int getScore()
{ score=0;
int length1=selection.length();
int length2=correctAnswer.length();
int min=Math.min(length1,length2);
for(int i=0;i<min;i++)
{ try{
if(selection.charAt(i)==correctAnswer.charAt(i))
score++;
}
catch( e)
{
i=0;
}
}
return score;
}20:10 03-8-31
public String getMessages()
{
int length1=selection.length();
int length2=correctAnswer.length();
int length=Math.min(length1,length2);
String message="正確答案:"+correctAnswer.substring(0,length)+"\n"+
"你的回答:"+selection+"\n";
return message;
}
}
//考試區域TestArea
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.io.*;
class FileName implements FilenameFilter
{
String str=null;
FileName (String s)
{
str="."+s;
}
public boolean accept(File dir,String name)
{
return name.endsWith(str);
}
}
public class TestArea extends JPanel implements ActionListener,ItemListener,Runnable
{
Choice list=null;
JTextArea 試題顯示區=null,消息區=null;
JCheckBox box[];
JButton 提交該題答案,讀取下一題,查看分數;
ReadTestquestion 讀取試題=null;
JLabel welcomeLabel=null;
Thread countTime=null;
long time=0;
JTextField timeShow=null;
boolean 是否關閉計時器=false,
是否暫停計時=false;
JButton 暫停或繼續計時=null;
public TestArea()
{
list= new Choice();
String 當前目錄=System.getProperty("user.dir");
File dir=new File(當前目錄);
FileName fileTxt=new FileName("txt");
String fileName[]=dir.list(fileTxt);
for(int i=0;i<fileName.length;i++)
{
list.add(fileName[i]);
}
試題顯示區=new JTextArea(15,12);
試題顯示區.setLineWrap(true);
試題顯示區.setWrapStyleWord(true);
試題顯示區.setFont(new Font("TimesRoman",Font.PLAIN,14));
試題顯示區.setForeground(Color.blue);
消息區=new JTextArea(8,8);
消息區.setForeground(Color.blue);
消息區.setLineWrap(true);
消息區.setWrapStyleWord(true);
countTime=new Thread(this);
String s[]={"A","B","C","D"};
box=new JCheckBox[4];
for(int i=0;i<4;i++)
{
box[i]=new JCheckBox(s[i]);
}
暫停或繼續計時=new JButton("暫停計時");
暫停或繼續計時.addActionListener(this);
提交該題答案=new JButton("提交該題答案");
讀取下一題=new JButton("讀取第一題");
讀取下一題.setForeground(Color.blue);
提交該題答案.setForeground(Color.blue);
查看分數=new JButton("查看分數");
查看分數.setForeground(Color.blue);
提交該題答案.setEnabled(false);
提交該題答案.addActionListener(this);
讀取下一題.addActionListener(this);
查看分數.addActionListener(this);
list.addItemListener(this);
讀取試題=new ReadTestquestion();
JPanel pAddbox=new JPanel();
for(int i=0;i<4;i++)
{
pAddbox.add(box[i]);
}
Box boxH1=Box.createVerticalBox(),
boxH2=Box.createVerticalBox(),
baseBox=Box.createHorizontalBox();
boxH1.add(new JLabel("選擇試題文件"));
boxH1.add(list);
boxH1.add(new JScrollPane(消息區));
boxH1.add(查看分數);
timeShow=new JTextField(20);
timeShow.setHorizontalAlignment(SwingConstants.RIGHT);
timeShow.setEditable(false);
JPanel p1=new JPanel();
p1.add(new JLabel("剩餘時間:"));
p1.add(timeShow);
p1.add(暫停或繼續計時);
boxH1.add(p1);
boxH2.add(new JLabel("試題內容:"));
boxH2.add(new JScrollPane(試題顯示區));
JPanel p2=new JPanel();
p2.add(pAddbox);
p2.add(提交該題答案);
p2.add(讀取下一題);
boxH2.add(p2);
baseBox.add(boxH1);
baseBox.add(boxH2);
setLayout(new BorderLayout());
add(baseBox,BorderLayout.CENTER);
welcomeLabel=new JLabel("歡迎考試,提高英語水平",JLabel.CENTER);
welcomeLabel.setFont(new Font("隸書",Font.PLAIN,24));
welcomeLabel.setForeground(Color.blue);
add(welcomeLabel,BorderLayout.NORTH);
}
public void itemStateChanged(ItemEvent e)
{
timeShow.setText(null);
是否關閉計時器=false;
是否暫停計時=false;
暫停或繼續計時.setText("暫停計時");
String name=(String)list.getSelectedItem();
讀取試題.setFilename(name);
讀取試題.set完成考試(false);
time=讀取試題.getTime();
if(countTime.isAlive())
{
是否關閉計時器=true;
countTime.interrupt();
}
countTime=new Thread(this);
消息區.setText(null);
試題顯示區.setText(null);
讀取下一題.setText("讀取第一題");
提交該題答案.setEnabled(false);
讀取下一題.setEnabled(true);
welcomeLabel.setText("歡迎考試,你選擇的試題:"+讀取試題.getFilename());
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==讀取下一題)
{
讀取下一題.setText("讀取下一題");
提交該題答案.setEnabled(true);
String contentTest=讀取試題.getTestContent();
試題顯示區.setText(contentTest);
消息區.setText(null);
讀取下一題.setEnabled(false);
try {
countTime.start();
}
catch(Exception event)
{
}
}
if(e.getSource()==提交該題答案)
{
讀取下一題.setEnabled(true);
提交該題答案.setEnabled(false);
String answer="?";
for(int i=0;i<4;i++)
{
if(box[i].isSelected())
{
answer=box[i].getText();
box[i].setSelected(false);
break;
}
}
讀取試題.setSelection(answer);
}
if(e.getSource()==查看分數)
{
int score=讀取試題.getScore();
String messages=讀取試題.getMessages();
消息區.setText("分數:"+score+"\n"+messages);
}
if(e.getSource()==暫停或繼續計時)
{
if(是否暫停計時==false)
{
暫停或繼續計時.setText("繼續計時");
是否暫停計時=true;
}
else if(是否暫停計時==true)
{
暫停或繼續計時.setText("暫停計時");
是否暫停計時=false;
countTime.interrupt();
}
}
}
public synchronized void run()
{
while(true)
{
if(time<=0)
{
是否關閉計時器=true;
countTime.interrupt();
提交該題答案.setEnabled(false);
讀取下一題.setEnabled(false);
timeShow.setText("用時盡,考試結束");
}
else if(讀取試題.get完成考試())
{
是否關閉計時器=true;
timeShow.setText("考試效果:分數*剩餘時間(秒)="+1.0*讀取試題.getScore()*(time/1000));
countTime.interrupt();
提交該題答案.setEnabled(false);
讀取下一題.setEnabled(false);
}
else if(time>=1)
{
time=time-1000;
long leftTime=time/1000;
long leftHour=leftTime/3600;
long leftMinute=(leftTime-leftHour*3600)/60;
long leftSecond=leftTime%60;
timeShow.setText(""+leftHour+"小時"+leftMinute+"分"+leftSecond+"秒");
}
try
{
Thread.sleep(1000);
}
catch(InterruptedException ee)
{
if(是否關閉計時器==true)
return ;
}
while(是否暫停計時==true)
{
try
{
wait();
}
catch(InterruptedException ee)
{
if(是否暫停計時==false)
{
notifyAll();
}
}
}
}
}
}