毕业论文- 基于Android的驾校模拟考试系统_第1页
毕业论文- 基于Android的驾校模拟考试系统_第2页
毕业论文- 基于Android的驾校模拟考试系统_第3页
毕业论文- 基于Android的驾校模拟考试系统_第4页
毕业论文- 基于Android的驾校模拟考试系统_第5页
已阅读5页,还剩27页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、河北农业大学本科毕业论文题 目: 学 院: 信息科学与技术学院 专业班级: 软件工程1002班 学 号: 学生姓名: 指导教师姓名: 指导教师职称: 讲 师 二零一四 年 六 月 一 日摘要 移动互联网时代的到来极大的改变了我们的生活,而Android是一种以Linux为基础的开放源码操作系统迅速占领了智能机操作系统,所以在android环境下开发显得尤为必要。Android是开放性体系架构,不仅具有非常好的开发、调试环境,而且还支持各种可扩展的用户体验,包括丰富的图形组件、多媒体支持功能以及强大的浏览器。因此,对于软件从业人员来说,Android平台具有无限的吸引力。 本文就在分析讨论And

2、roid手机软件开发技术原理的基础上,为用户开发出基于Android平台的驾校模拟考试系统。通过对Android系统架构和应用开发进行初步研究和对系统进行详细需求分析的基础上,确定了系统的功能和性能要求。本文详细介绍了在Android平台上以Java为语言编完成开发的过程,最终实现了一个界面友好、操作简单的手机驾校模拟考试系统。 关键词:汽车;智能手机;Android;考试系统。AbstractMobile Internet era of great change in our lives, and Android is a Linux-based open source operating

3、system and quickly occupied the smart operating system, so in the android development environment is particularly necessary. Android is an open architecture, not only has a very good development and debugging environment, but also supports a variety of scalable user experience, including rich graphi

4、cal components, multimedia support and a powerful browser. Therefore, for software professionals who, Android platform has unlimited appeal.In this paper, based on the analysis discussed Android mobile software development technology principle, for the user to develop a simulation-based driving scho

5、ol exam system Android platform. Through the Android-based system architecture and application development and preliminary study of the system on a detailed needs analysis to determine the functional and performance requirements of the system. This paper describes on the Android platform, Java-langu

6、age code to complete the development process, and ultimately a friendly interface, simple operation handset Driving simulation test system.Keywords : auto ; smart phones ; Android; examination system.目 录 TOC o 1-3 h z u HYPERLINK l _Toc390248863 1 绪论 数据的安全性:数据的安全性是数据库设计过程的基本要求。保护数据库,防止权限的混乱造成的数据库中数据

7、被窜改、信息的泄露,或者是导致数据不完整、丢失或不可恢复。3.3业务流程分析系统面向多用户,每一个用户的考试过程和结果的信息都要被记录,所以说在进入考试之前要先进行用户注册,之后用户登录进行考试,开始考试之后,系统要求实现考试过程中的错题详解,实现每错一题便详细学习一题的目的,从而达到高效复习的效果,所以说,对于每一位学员,答对题目直接跳过,答错的题目将出现正确答案和题目解析。答题完毕之后点击提交试卷,系统进行自动评分同时给予考试评价。4 系统设计4.1系统设计目标 了解到本系统要完成的功能,以及服务的对象,本系统主要服务于所有参加或者想要参加驾校考试的学员,以便捷性,精准性为主,实现随时随地

8、进行驾校模拟考试的功能。4.2 系统功能模块设计从前面功能需求分析可以设计1个主要功能模块,是模拟考试。4个次要功能模块,即考试科目,试题内容,考试结束条件,查看测试结果。1.模拟考试内容:表4-1考试内容科目试题数量每题分数限定时间总分数及格分数C1、C2科目一10014510090C1、C2科目四5023010090 2.考试结束条件、考试期间可进行的操作和考试过程可查看的内容考生答完所有题目并进行提交试卷操作,若没有答完所有试题,不允许提交试卷。 考试时间结束,强制结束考试。 放弃考试,此次考试作废。 可查看时间倒计时。 可查看未答题、已答题、答错题、标记题4.3 数据库设计 1. C1

9、、C2科目一试题表 表4-2 数据库字段字段名称类型可为空默认值注释idintN试题IDchaptercharN所属科目章节q_typecharN试题类型q_nameintN试题名称q_answercharN试题答案q_analysisintY试题分析option_aintY试题选项option_blongYoption_cintYoption_dcharYq_imgurl_ncharY试题图片q_imgurl_lcharY大图q_imgurl_slongY小图 2.C1、C2科目四试题表表名:st_c1c2_k4 与表4-2数据库字段相同创建数据库代码:package com.driving

10、license.database;import java.util.ArrayList;import java.util.Map;import com.drivinglicense.pojo.TestQuestion;import com.drivinglicense.utils.DataBaseUtil;import android.content.Context;import android.database.Cursor;import android.database.sqlite.SQLiteDatabase;import android.database.sqlite.SQLiteO

11、penHelper;public class ClientDataBase private Context context = null;private static final int DB_VERSION = 1;public final static String TABLE_K1 = st_c1c2_k1;public final static String TABLE_K4 = st_c1c2_k4;private SQLiteDatabase sqLiteDatabase = null;private SqliteHelper sqliteHelper = null;private

12、 static class SqliteHelper extends SQLiteOpenHelper public SqliteHelper(Context context) super(context, DataBaseUtil.DB_NAME, null, DB_VERSION);Overridepublic void onCreate(SQLiteDatabase db) Overridepublic void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) public ClientDataBase(Conte

13、xt context) this.context = context;public boolean open() if (DataBaseUtil.isDatabaseOperating) return false;sqliteHelper = new SqliteHelper(context);sqLiteDatabase = sqliteHelper.getWritableDatabase();DataBaseUtil.isDatabaseOperating = true;return true;public void close() sqliteHelper.close();DataBa

14、seUtil.isDatabaseOperating = false;public ArrayList getTestQuestions(String tableName) ArrayList testQuestions = new ArrayList();Cursor cursor = sqLiteDatabase.rawQuery(getQuerySQL(tableName), null);if (cursor.moveToFirst() do TestQuestion testQuestion = new TestQuestion();testQuestion.setId(cursor.

15、getInt(0);testQuestion.setChapter(cursor.getInt(1);testQuestion.setQ_type(cursor.getInt(2);testQuestion.setQ_name(cursor.getString(3);testQuestion.setQ_answer(cursor.getInt(4);testQuestion.setQ_analysis(cursor.getString(5);Map options = testQuestion.getOptions();options.put(cursor.getColumnName(6),

16、cursor.getString(6);options.put(cursor.getColumnName(7), cursor.getString(7);options.put(cursor.getColumnName(8), cursor.getString(8);options.put(cursor.getColumnName(9), cursor.getString(9);Map q_imgurl = testQuestion.getQ_imgurl();q_imgurl.put(cursor.getColumnName(10), cursor.getString(10);q_imgur

17、l.put(cursor.getColumnName(11), cursor.getString(11);q_imgurl.put(cursor.getColumnName(12), cursor.getString(12);testQuestions.add(testQuestion); while (cursor.moveToNext();cursor.close();return testQuestions;private String getQuerySQL(String tableName) return SELECT * FROM + tableName + ORDER BY RA

18、NDOM() limit 100;链接数据库代码:package com.drivinglicense.utils;import java.io.File;import java.io.FileOutputStream;import java.io.InputStream;import java.io.OutputStream;import android.content.Context;/* * * * author zhengyx * since 2014-1-25 上午9:49:09 * version 1.0 * */public class DataBaseUtil / - 数据库操

19、作状态public static boolean isDatabaseOperating = false;public final static String DB_NAME = jzmnks.db;private final static String DataBaseDir = databases;public String GetDataBasePath(Context context) String packageName = context.getPackageName();/Log.i(PackName, packageName);/ String DB_PATH = String

20、.format(/data/data/%1$s/databases/,/ packageName);String DB_PATH = File.separator + data + File.separator + data+ File.separator + packageName + File.separator + DataBaseDir;String DB_ASSETS_PATH = DataBaseDir + File.separator + DB_NAME;if (!(new File(DB_PATH).exists() try / 如 SQLite 数据库文件不存在,再检查一下

21、database 目录是否存在File f = new File(DB_PATH);/ 如 database 目录不存在,新建该目录if (!f.exists() f.mkdir();/ 得到 assets 目录下我们实现准备好的 SQLite 数据库作为输入流InputStream is = context.getAssets().open(DB_ASSETS_PATH);/ 输出流OutputStream os = new FileOutputStream(DB_PATH + File.separator+ DB_NAME);/ 文件写入byte buffer = new byte1024

22、;int length;while (length = is.read(buffer) 0) os.write(buffer, 0, length);/ 关闭文件流os.flush();os.close();is.close(); catch (Exception e) e.printStackTrace();return DB_PATH;5 系统的实现5.1系统登录 进入系统登录界面先注册用户信息,然后登陆,以便能够保证每一位学员信息及考试能容信息得到保存。如图5-1所示。 图5-1 登陆界面登陆注册界面实现代码:package com.drivinglicense.options.logi

23、n;import com.drivinglicense.R;import com.drivinglicense.service.AppBaseFragmentActivity;import com.drivinglicense.service.MobileApplication;import android.os.Bundle;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;import android.widget.RadioGroup;/* * 登陆

24、、注册控制类 * * author zhengyx * since 2014-1-3 下午12:14:29 * version 1.0 * */public class LoginActivity extends AppBaseFragmentActivity implementsLoginTopFragment.Callbacks public static String Position = position;private Button parentdialog_cancel_Button;public static Button parentdialog_confirm_Button;

25、Overrideprotected void onCreate(Bundle savedInstanceState) MobileApplication.allActivity.add(this);super.onCreate(savedInstanceState);private OnClickListener clickListener = new OnClickListener() Overridepublic void onClick(View v) switch (v.getId() case R.id.parentdialog_cancel_Button:finish();brea

26、k;default:break;Overridepublic void onRadioGroupCheckedChanged(RadioGroup radioGroup, int checkedId) toFragment(checkedId);Overrideprotected int getLayoutId() return R.layout.login;Overrideprotected void setupView() parentdialog_cancel_Button = (Button) findViewById(R.id.parentdialog_cancel_Button);

27、parentdialog_cancel_Button.setOnClickListener(clickListener);parentdialog_confirm_Button = (Button) findViewById(R.id.parentdialog_confirm_Button);Overrideprotected void initializedData() onRadioGroupCheckedChanged(null, R.id.login_tab_1_RadioButton);5.2主界面登陆之后进入系统主界面,如图5-2所示。 图5-2 主界面系统主界面实现代码:pack

28、age com.drivinglicense.options;import com.drivinglicense.R;import com.drivinglicense.options.about.AboutActivity;import com.drivinglicense.options.beginexam.ExamActivity;import com.drivinglicense.options.cartype.CarTypeActivity;import com.drivinglicense.options.login.ExitAppActivity;import com.drivi

29、nglicense.options.login.LoginActivity;import com.drivinglicense.options.login.LogoutActivity;import com.drivinglicense.options.login.UserInfo;import com.drivinglicense.options.setting.SettingActivity;import com.drivinglicense.service.AppBaseFragmentActivity;import com.drivinglicense.service.MobileAp

30、plication;import android.content.Intent;import android.os.Bundle;import android.view.KeyEvent;import android.view.View;import android.view.View.OnClickListener;public class MainActivity extends AppBaseFragmentActivity implementsMainMiddleFragment.Callbacks private View main_login_RelativeLayout, mai

31、n_exit_RelativeLayout;public static View main_unlogin_ImageView;Overrideprotected void onCreate(Bundle savedInstanceState) MobileApplication.allActivity.add(this);super.onCreate(savedInstanceState);Overridepublic void onClick(View view) Intent intent = null;switch (view.getId() case R.id.main_top_le

32、ft_RelativeLayout:intent = new Intent(MainActivity.this, SettingActivity.class);break;case R.id.main_top_right_RelativeLayout:if (UserInfo.isOnLine) intent = new Intent(MainActivity.this, ExamActivity.class); else show(R.string.nologin);break;case R.id.main_bottom_left_RelativeLayout:intent = new In

33、tent(MainActivity.this, AboutActivity.class);break;case R.id.main_bottom_right_RelativeLayout:intent = new Intent(MainActivity.this, CarTypeActivity.class);break;default:break;if (intent != null) MainActivity.this.startActivity(intent);private OnClickListener clickListener = new OnClickListener() Ov

34、erridepublic void onClick(View view) Intent intent = null;switch (view.getId() case R.id.main_login_RelativeLayout:if (UserInfo.isOnLine) intent=newIntent(MainActivity.this, LogoutActivity.class); else intent=newIntent(MainActivity.this, LoginActivity.class);break;case R.id.main_exit_RelativeLayout:

35、intent = new Intent(MainActivity.this, ExitAppActivity.class);break;default:break;if (intent != null) MainActivity.this.startActivity(intent);Overrideprotected int getLayoutId() return R.layout.main;Overrideprotected void setupView() main_login_RelativeLayout = findViewById(R.id.main_login_RelativeL

36、ayout);main_unlogin_ImageView = findViewById(R.id.main_unlogin_ImageView);main_exit_RelativeLayout = findViewById(R.id.main_exit_RelativeLayout);main_login_RelativeLayout.setOnClickListener(clickListener);main_exit_RelativeLayout.setOnClickListener(clickListener);Overrideprotected void initializedDa

37、ta() Overridepublic boolean dispatchKeyEvent(KeyEvent event) if (event.getKeyCode() = KeyEvent.KEYCODE_BACK & event.getAction() = KeyEvent.ACTION_DOWN) Intentintent=newIntent(MainActivity.this, ExitAppActivity.class);MainActivity.this.startActivity(intent);return true; else return super.dispatchKeyE

38、vent(event);5.3开始考试 进入主界面后,选择考试类型开始进行答题考试,答案正确直接进入下一题,答案错误则会出现相应题目解析。如图5-3所示。图5-3 考试界面考试界面控制代码:package com.drivinglicense.options.beginexam;import java.util.ArrayList;import android.os.Bundle;import android.view.KeyEvent;import android.view.View;import android.view.View.OnClickListener;import androi

39、d.widget.TextView;import android.widget.Toast;import com.android.threadpool.IActivity;import com.android.threadpool.Task;import com.drivinglicense.R;import com.drivinglicense.database.ClientDataBase;import com.drivinglicense.pojo.TestQuestion;import com.drivinglicense.service.AppBaseFragmentActivity

40、;import com.drivinglicense.service.MobileApplication;import com.drivinglicense.service.TaskID;import com.drivinglicense.widget.dialog.ExamConfirmDialog;/* * 考试页面控制类 * * author zhengyx * since 2014-1-24 上午10:27:01 * version 1.0 * */public class ExamActivity extends AppBaseFragmentActivity implementsE

41、xamBottomFragment.Callbacks, IActivity private TextView back_TextView, confirm_TextView;private ExamConfirmDialog confirmDialog;private ArrayList testQuestions;public static int index = 0;Overrideprotected void onCreate(Bundle savedInstanceState) MobileApplication.allActivity.add(this);MobileApplica

42、tion.allIActivity.add(this);super.onCreate(savedInstanceState);private OnClickListener clickListener = new OnClickListener() Overridepublic void onClick(View view) switch (view.getId() case R.id.exam_header_left_TextView:ExamBottomFragment.stopTimer();finish();break;case R.id.exam_header_right_TextV

43、iew:ExamBottomFragment.isPause = true;confirmDialog = new ExamConfirmDialog(ExamActivity.this, this, this);confirmDialog.show();break;case R.id.parentdialog_cancel_Button:ExamBottomFragment.isPause = false;confirmDialog.cancel();break;case R.id.parentdialog_confirm_Button:confirmDialog.cancel();Exam

44、BottomFragment.stopTimer();finish();break;default:break;Overrideprotected int getLayoutId() return R.layout.exam;Overrideprotected void setupView() back_TextView = (TextView) findViewById(R.id.exam_header_left_TextView);confirm_TextView = (TextView) findViewById(R.id.exam_header_right_TextView);back

45、_TextView.setOnClickListener(clickListener);confirm_TextView.setOnClickListener(clickListener);Overrideprotected void initializedData() Task task = new Task(TaskID.TASK_QUERY_TESTQUESTION, ClientDataBase.TABLE_K1, this.getClass().getName(), -随机抽取考题-);loadingDialog.show();MobileApplication.poolManage

46、r.addTask(task);Overridepublic void onClick(View view) switch (view.getId() case R.id.exam_tab_previous_Button:if (index 0) index-; else Toast.makeText(ExamActivity.this, R.string.exam_noprevious_question, Toast.LENGTH_SHORT).show();break;case R.id.exam_tab_next_Button:if (index 100) index+; else To

47、ast.makeText(ExamActivity.this, R.string.exam_nonext_question, Toast.LENGTH_SHORT).show();break;default:break;toFragment(new ExamContentFragment(), testQuestions.get(index), index);Overridepublic boolean onKeyDown(int keyCode, KeyEvent event) if (keyCode= KeyEvent.KEYCODE_BACK & event.getAction() = KeyEvent.ACTION_DOWN) ExamBottomFragment.stopTimer();finish();return true; else return super.onKeyDown(keyCode, event);Overridepublic void closeLoadingView() Overridepublic vo

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论