【视频在线下载网页源码】【acquire源码解析】【ai扫雷源码】java上机考试源码_java上机考试题库
1.java?上机上机ϻ?????Դ??
2.用JAVA写出源代码。运行结果如下?
3.企业在线考试系统源码
4.java源代码 求大神 明天就要上机
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(,,,);
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=*(second+minute*+hour**);
}
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(StringIndexOutOfBoundsException e)
{
i=0;
}
}
return score;
}: -8-
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(,);
试题显示区.setLineWrap(true);
试题显示区.setWrapStyleWord(true);
试题显示区.setFont(new Font("TimesRoman",Font.PLAIN,));
试题显示区.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();
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,));
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/));
countTime.interrupt();
提交该题答案.setEnabled(false);
读取下一题.setEnabled(false);
}
else if(time>=1)
{
time=time-;
long leftTime=time/;
long leftHour=leftTime/;
long leftMinute=(leftTime-leftHour*)/;
long leftSecond=leftTime%;
timeShow.setText(""+leftHour+"小时"+leftMinute+"分"+leftSecond+"秒");
}
try
{
Thread.sleep();
}
catch(InterruptedException ee)
{
if(是否关闭计时器==true)
return ;
}
while(是否暂停计时==true)
{
try
{
wait();
}
catch(InterruptedException ee)
{
if(是否暂停计时==false)
{
notifyAll();
}
}
}
}
}
}
用JAVA写出源代码。运行结果如下?
您好:代码及运行结果如下,上机上机供参考:
代码示意图
运行结果示意图
因输出的考试考试内容中包含特殊字符,所以在输出的源码时候,需要做转义,题库以上代码供参考。上机上机
企业在线考试系统源码
企业在线考试系统的考试考试源码设计是提升培训效果的关键。本文主要探讨了基于Java技术和中间件构建高效、源码acquire源码解析防作弊的题库在线考试平台的过程。首先,上机上机丰富的考试考试试题库通过Java实现批量导入和管理;试卷组卷功能支持固定和随机选项,同样由Java代码驱动。源码考试任务的ai扫雷源码设置,如考试次数限制,由Java实体类和Repository接口来设定,如ExamTask实体。
为了保证公平,系统内置防作弊措施,python源码修订通过Java实现复杂的数据验证和监控。考试结束后,自动成绩评估和报告生成功能为管理者提供详尽信息。系统能够与HRM和LMS等其他系统无缝集成,实现数据同步,福瑞源码且支持二次开发以满足个性化需求。
Java中间件在这个过程中扮演重要角色,如Spring Boot简化了开发,Apache Kafka处理实时数据,RabbitMQ负责异步任务。例如,Spring Boot的内置服务器简化应用部署,Kafka确保日志处理高效,RabbitMQ则用于处理消息传递。通过这些技术,企业可以构建出稳定且可扩展的在线考试平台,如内训宝企业在线培训平台,助力企业提高培训效率和公平性。
这篇文章希望能为企业构建在线考试系统提供实用指导。如有任何疑问或需求,欢迎随时咨询。
java源代码 求大神 明天就要上机
package com.uisftec;
import java.io.Serializable;
public class TestScores implements Serializable {
private double[] testScores;
public TestScores(double[] testScores) {
this.testScores = testScores;
}
public double getAverageScore() {
double sum = 0.0d;
for (int i = 0; i < testScores.length; i++) {
sum += testScores[i];
}
return sum / testScores.length;
}
}
package com.uisftec;
public class InvalidTestScore {
public InvalidTestScore(double[] testScores) {
if (testScores == null) {
throw new IllegalArgumentException("数组为空");
}
for (int i = 0; i < testScores.length; i++) {
if (testScores[i] < 0 || testScores[i] > ) {
throw new IllegalArgumentException("数组中包含的test Score不在0~这个范围内");
}
}
}
}
package com.uisftec;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
public class TestScoresSerialize {
public static void main(String[] args) throws FileNotFoundException, IOException, ClassNotFoundException {
// 创建5个对象
TestScores testScores1 = new TestScores(new double[] { 1.0, 2.0 });
TestScores testScores2 = new TestScores(new double[] { 5.0, 2.0 });
TestScores testScores3 = new TestScores(new double[] { .0, .0 });
TestScores testScores4 = new TestScores(new double[] { .0, .0 });
TestScores testScores5 = new TestScores(new double[] { .0, .0 });
// 创建数组
TestScores[] testScores = new TestScores[] { testScores1, testScores2, testScores3, testScores4, testScores5 };
// 写入到D盘testScores.dat
ObjectOutput out = new ObjectOutputStream(new FileOutputStream("d:\\testscores.dat"));
for (TestScores testScores6 : testScores) {
out.writeObject(testScores6);
}
// D盘STOUT
File file = new File("D:\\STDOUT");
// 创建输出留
DataOutputStream outputStream = new DataOutputStream(new FileOutputStream(file));
// 创建读取d盘序列化对象
ObjectInputStream in = new ObjectInputStream(new FileInputStream("d:\\testscores.dat"));
// 打印平均分并写入到D盘STDOUT
TestScores testScores8 = (TestScores) in.readObject();
System.out.println(testScores8.getAverageScore());
outputStream.writeDouble(testScores8.getAverageScore());
TestScores testScores9 = (TestScores) in.readObject();
outputStream.writeDouble(testScores9.getAverageScore());
System.out.println(testScores9.getAverageScore());
TestScores testScores = (TestScores) in.readObject();
System.out.println(testScores.getAverageScore());
outputStream.writeDouble(testScores.getAverageScore());
TestScores testScores = (TestScores) in.readObject();
System.out.println(testScores.getAverageScore());
outputStream.writeDouble(testScores.getAverageScore());
TestScores testScores = (TestScores) in.readObject();
System.out.println(testScores.getAverageScore());
outputStream.writeDouble(testScores.getAverageScore());
// 关闭流
out.close();
in.close();
outputStream.close();
}
}