Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1. Introduction
3. System Implementation
5. User Manual
6. References
1
1. Introduction
The Online Quiz is a GUI application for candidate to appear for an online test in
an effective way and there is no loss of time to check the paper. The chief aim of
Generally, pupil is provided with paper, pen etc. for taking the test but the Online
This software, being simple in design and working, does not require much of
training to users, and can be used as a powerful tool for automating a Quiz.
During coding and design of the software Project, Java NetBeans IDE, a powerful
front-end tool is used for getting Graphical User Interface (GUI) based integrated
Course.
2
2. Objective & Scope of the Project
Economic feasibility
Time flexibility
Technical feasibility
User-friendly interface
Eco-Friendly System
The candidates can login through the client computers with their roll number
given to them and can take the exam.
3
3. System Implementation
4
4. System Design & Development
4.1 Database Design:
An important aspect of system design is the design of data storage structure. To begin with a
logical model of data structure is developed first. A database is a container object which contains
tables, queries, reports and data validation policies enforcement rules or contraints etc. A logical
data often represented as a records are kept in different tables after reducing anomalies and
redundancies. The goodness of data base design lies in the table structure and its relationship.
This software project maintains a database named QUIZ which contains the following tables.
Table Design:
The database of Quiz System contains 4 tables. The tables are normalized to minimize the
redundancies of data and enforcing the validation rules of the organization. Most of the tables
are designed to store master records. The tables and their structure are given below.
Table: LogIn
Table: IP
5
Table: GK
Table: Result
Menu Forms
Sr. Pull Down Menu Purpose
Bar Attached
Test.java
IP Take a test for IP
1. Select Test.java
GK Take a test for GK
--
2. Exit QUIT Close application
6
4.3 I/O Forms Design & Event Coding:
The software project for Public Quiz Management contains various forms along with
programming codes. Forms (JFrames) and their event coding are given below.
Frame: LogIn.java
Coding of LOGIN.java
import java.sql.*;
public class LogIn extends javax.swing.JFrame {
/** Constructor */
public LogIn() {
initComponents();
}
Frame: Register.java
8
Coding of Register.java
import java.sql.*;
import javax.swing.JOptionPane;
public class Register extends javax.swing.JFrame {
/** Constructor */
public Register() {
initComponents();
}
private void RegisterTFActionPerformed(java.awt.event.ActionEvent evt) {
try {
Class.forName("java.sql.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/quizdb",
"root", "kvuc");
Statement stmt = conn.createStatement();
String sql;
sql = "insert into Result values ('" + IDTF.getText() + "',0,0,0,0)";
stmt.executeUpdate(sql);
sql = "insert into LogIn values ( '" + IDTF.getText() + "' , '" + PasswordTf.getText() +
"' )";
stmt.executeUpdate(sql);
stmt.close();
conn.close();
new Menu(IDTF.getText()).setVisible(true);
this.setVisible(false);
9
}
catch( Exception e)
{
JOptionPane.showMessageDialog(null,"" + e);
}
}
Frame: Menu.java
11
Coding for Test.Java
import java.sql.*;
import javax.swing.JOptionPane;
public class Test extends javax.swing.JFrame {
String ID;
String Subject;
int index =1;
int max =0;
int result = 0;
char [] answers;
/** Constructor */
public Test()
{
initComponents();
}
public Test(String subject, String id)
{
initComponents();
ID = id;
Subject = subject;
PrevBTN.setVisible(false);
try
12
{Class.forName("java.sql.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/quizdb",
"root", "kvuc");
Statement stmt = conn.createStatement();
String sql = "select max(SNo) from " + Subject;
ResultSet rs = stmt.executeQuery(sql);
rs.next();
max = rs.getInt(1);
answers = new char[max];
for(int i=0; i<max;i++) {
answers[i] = 'e';
}
rs.close();
stmt.close();
conn.close();
getQues();
}
catch(Exception r){ JOptionPane.showMessageDialog(null,""+ r);
}
}
private void getQues()
{
try
{
Class.forName("java.sql.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/quizdb",
"root", "kvuc");
Statement stmt = conn.createStatement();
String sql = "select * from " + Subject + " where SNo = " + index;
ResultSet rs = stmt.executeQuery(sql);
rs.next();
QuesTA.setText("\nQ" + index + ". " + rs.getString(2));
a.setText(rs.getString("a"));
b.setText(rs.getString("b"));
c.setText(rs.getString("c"));
d.setText(rs.getString("d"));
a.setSelected(answers[index-1] == 'a');
b.setSelected(answers[index-1] == 'b');
13
c.setSelected(answers[index-1] == 'c');
d.setSelected(answers[index-1] == 'd');
e.setSelected(answers[index-1] == 'e');
rs.close();
stmt.close();
conn.close();
}
catch(Exception r){ JOptionPane.showMessageDialog(null,""+ r); }
}
private void PrevBTNActionPerformed(java.awt.event.ActionEvent evt) {
index--;
getQues();
if(index == 1) {
PrevBTN.setVisible(false);
}
if(index < max) {
NextBTN.setVisible(true);
}
}
private void NextBTNActionPerformed(java.awt.event.ActionEvent evt) {
index++;
getQues();
if(index == max) {
NextBTN.setVisible(false);
}
if(index > 1) {
PrevBTN.setVisible(true);
}
}
private void bActionPerformed(java.awt.event.ActionEvent evt) {
answers[index-1] = 'b';
}
private void ResultBTNActionPerformed(java.awt.event.ActionEvent evt) {
try
{
Class.forName("java.sql.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/quizdb",
"root", "kvuc");
14
Statement stmt = conn.createStatement();
String sql = "select Result from " + Subject;
ResultSet rs = stmt.executeQuery(sql);
int i = 0;
while(rs.next())
{
char ans = rs.getString(1).charAt(0);
if(ans == answers[i]) {
result++;
}
i++;
}
float res = ((float)result * 100 ) / max;
sql = "Select " + Subject + "Result from Result where ID = '" + ID + "'";
rs = stmt.executeQuery(sql);
rs.next();
if(res > rs.getFloat(1))
{
sql = "update Result set " + Subject + "Result = " + res + " where ID = '" + ID + "'";
stmt.executeUpdate(sql);
}
stmt.close();
conn.close();
new Result(res,ID).setVisible(true);
this.setVisible(false);
}
catch(Exception r){ JOptionPane.showMessageDialog(null,r); }
}
private void aActionPerformed(java.awt.event.ActionEvent evt) {
answers[index-1] = 'a';
}
private void cActionPerformed(java.awt.event.ActionEvent evt) {
answers[index-1] = 'c';
}
private void dActionPerformed(java.awt.event.ActionEvent evt) {
answers[index-1] = 'd';
}
public static void main(String args[]) {
15
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Test().setVisible(true);
}
});}
Frame: Result.java
Coding of Result.java
import java.sql.*;
import javax.swing.table.*;
import javax.swing.JOptionPane;
public class Result extends javax.swing.JFrame {
float result;
16
String ID;
/** Creates new form Result */
public Result() {
initComponents();
}
public Result(float res, String id)
{
initComponents();
result = res;
ID = id;
Score.setText(res + "%");
try {
Class.forName("java.sql.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/quizdb",
"root", "kvuc");
Statement stmt = conn.createStatement();
String sql = "select * from Result where ID = '" + ID + "'";
ResultSet rs = stmt.executeQuery(sql);
Object[] newrow = new Object[5];
newrow[0] = "MAX MARKS";
rs.next();
for(int i=1; i<=4;i++) {
newrow[i] = rs.getString(i+1);
}
DefaultTableModel tm = (DefaultTableModel)scoreTBL.getModel();
tm.addRow(newrow);
}
catch (Exception e) { JOptionPane.showMessageDialog(null,"" + e);
}
}
private void BackBTNActionPerformed(java.awt.event.ActionEvent evt) {
new Menu(ID).setVisible(true);
this.setVisible(false);
}
17
private void exitBTNActionPerformed(java.awt.event.ActionEvent evt) {
this.dispose();
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Result().setVisible(true);
}
});
18
5. User Manual
7.1 Working with Software Project:
The Quiz Management Program consists of the following logically organised Menu-structure for
the easy functionality. User may choose the menu options for corresponding works.
Select:
This menu item gives options to select java, html, dbms and networking.
Exit:
This menu closes the application.
19
6. References
In order to work on this project titled -LibSys – Public Library Management System, the
following books and literature are refered by me during the various phases of development of
the project.
1. http://www.mysql.org/
2. http://www.netbeans.org/
20