Documentos de Académico
Documentos de Profesional
Documentos de Cultura
A Project Report on
COMPUTER
QUIZ
[As a part of Informatics Practices Course (065)]
Submitted By:
Saurav Kumar
.
Teachers Signature
Name:
Saurav Kumar
ACKNOWLEDGMENT
We undertook this Project Work, as the part of our XII-Informatics
Practices Course. We had tried to apply our best knowledge
experience, gained during the study and class work experience.
However, developing software system is generally a quite complex
and time-consuming process. It requires a systematic study, insight
vision and professional approach during the design and development.
Moreover, the developer always feels the need, the help and good
wishes of the people near you, who have considerable experience and
idea.
We would like to extend our sincere thanks and gratitude to our teacher
Mr Tahseen Akhtar.
We would like to take the opportunity to extend our sincere thanks and
gratitude to our parents for being a source of inspiration and providing
time and freedom to develop this software project.
Saurav Kumar
Class XII
CONTENTS
1. Introduction
2. Objective and Scope of the Project
3. Theoretical Background
4. Problem Definition and Analysis
5. System Implementation
5.1 The Hardware Used
5.2 The Software Used
6. System Design and Development
6.1 Database Design
6.2 Menu Design
6.3 Forms Design and Event Coding
7. User Manual
8. References
INTRODUCTION
This purpose of the software project is to develop the Management
Information System (MIS) to automate the functionalities of a Quiz.
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 Computer
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 platform and coding simplicity. As a back-end a powerful,
open source RDBMS, My SQL is used as per requirement of the CBSE
curriculum of Informatics Practices Course.
OBJECTIVE AND SCOPE OF THE PROJECT
The objective of the software project is to develop a computerized MIS to
automate the functions of a Quiz. This software project is also aimed to
enhance the current record keeping system, which will help managers to
retrieve the up-to-date information at right time in right shape.
The proposed software system is expected to do the following functionality-
To provide a user friendly, Graphical User Interface (GUI) based
integrated and centralized environment for MIS activities.
The proposed system should maintain all the records and should generate
the required reports and information when required.
To provide graphical and user-friendly interface to interact with a
centralized database based on client-server architecture.
To identify the critical operation procedure and possibilities of
simplification using modern IT tools and practices.
In its current scope, the software enables user to retrieve and update the
information from centralized database designed with MySQL. This software
does not require much training time of the users due to limited functionality
and simplicity.
Despite of the best effort of the developer, the following limitations and
functional boundaries are visible, which limits the scope of this application
software.
1. This software can store records in pre-designed format in soft copy. There
is no facility yet to produce customized reports. Only specified reports are
covered.
What is MySQL?
Features of Netbeans
Hardware Used
Softwares Used
Database Design
3. javaquestion table:
4. mysqlquestion table:
The software project for Computer Quiz contains various forms along with
programming codes. Forms (JFrames) and their event coding are given below.
Frame: Login_Quiz
import javax.swing.JOptionPane;
private void redirectMouseClicked(java.awt.event.MouseEvent evt) {
f.setVisible(true);
this.dispose();
try {
Class.forName("java.sql.Driver");
java.sql.Connection con =
DriverManager.getConnection("jdbc:mysql://localhost/Quiz", "root", "");
java.sql.Statement st = con.createStatement();
int c = 1;
while (rs.next()) {
f.setVisible(true);
this.dispose();
c = 0;
if (c == 1) {
} catch (Exception e) {
System.out.println(e);
System.exit(0);
}
Frame: Register_Quiz
import javax.swing.JOptionPane;
String name=nametxt.getText();
String age=agetxt.getText();
String dob=dobtxt.getText();
String add1=addtxt.getText();
String brd=brdtxt.getText();
String uid=uidtxt.getText();
String sch1=schtxt.getText();
String pwd=String.valueOf(pwdtxt.getPassword());
String gen="";
if(rmale.isSelected())
gen="Male";
else if(rfmale.isSelected())
gen="Female";
int c=1;
if(name.equals("")||age.equals("")||dob.equals("")||add.equals("")||brd.equ
als("")||uid.equals("")||sch.equals("")||pwd.equals("")||gen.equals(""))
c=0;
if(c==1)
{
try
Class.forName("java.sql.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost/Quiz","root"
,"");
Statement st=con.createStatement();
int d=0;
while(rs.next())
String id=rs.getString(1);
if(id.equals(uid))
d=1;
if(d==0)
{
String query="INSERT INTO Login
values('"+name+"',"+age+",'"+dob+"','"+gen+"','"+add+"','"+brd+"','"+sch
+"','"+uid+"','"+pwd+"');";
int i=st.executeUpdate(query);
f.setVisible(true);
this.dispose();
catch(Exception e)
System.out.println(e);
f.setVisible(true);
this.dispose();
}
Frame: Home_Quiz
import javax.swing.JOptionPane;
//Global Variable
if(rjava.isSelected())
topic="javaQuestion";
else if(rhtml.isSelected())
topic="htmlquestion";
else if(rsql.isSelected())
topic="mysqlquestion";
if(topic.equals(""))
else
{
Question_Quiz f=new Question_Quiz();
f.setVisible(true);
this.dispose();
Frame: Question_Quiz
import java.util.Random;
//Global Variables
int c=0;
try
Class.forName("java.sql.Driver");
java.sql.Connection
con=DriverManager.getConnection("jdbc:mysql://localhost/Quiz","root",""
);
java.sql.Statement st=con.createStatement();
for(int i=0;i<=(qn-1);i++)
{
rs.next();
String an=rs.getString(1);
if(an.equals((ans)))
c=1;
catch(Exception e)
System.out.println(e);
return c;
int n1,n2,n3,n4;
n1=r.nextInt(4)+1;
for(;;)
{
n2=r.nextInt(4)+1;
if(n2!=n1)
break;
for(;;)
n3=r.nextInt(4)+1;
if(n3!=n1&&n3!=n2)
break;
for(;;)
n4=r.nextInt(4)+1;
if(n4!=n1&&n4!=n2&&n4!=n3)
break;
String s="opt"+n1+",opt"+n2+",opt"+n3+",opt"+n4;
return s;
String ans="";
if(opt1.isSelected())
ans=opt1.getText();
else if(opt2.isSelected())
ans=opt2.getText();
else if(opt3.isSelected())
ans=opt3.getText();
else if(opt4.isSelected())
ans=opt4.getText();
return ans;
try
Class.forName("java.sql.Driver");
java.sql.Connection
con=DriverManager.getConnection("jdbc:mysql://localhost/Quiz","root","");
java.sql.Statement st=con.createStatement();
ResultSet rs=st.executeQuery("Select question,"+optrandom()+" from
"+h.topic+";");
rs.next();
qlabel.setText(rs.getString(1));
opt1.setText(rs.getString(2));
opt2.setText(rs.getString(3));
opt3.setText(rs.getString(4));
opt4.setText(rs.getString(5));
catch(Exception e)
System.out.println(e);
String ans=selecteditem();
cq+=checkans(ans);
try
Class.forName("java.sql.Driver");
java.sql.Connection
con=DriverManager.getConnection("jdbc:mysql://localhost/Quiz","root","");
java.sql.Statement st=con.createStatement();
for(int i=0;i<=qn;i++)
rs.next();
if(qn==3)
nxt.setVisible(false);
getres.setVisible(true);
qlabel.setText(rs.getString(1));
opt1.setText(rs.getString(2));
opt2.setText(rs.getString(3));
opt3.setText(rs.getString(4));
opt4.setText(rs.getString(5));
qn+=1;
}
catch(Exception e)
System.out.println(e);
buttonGroup1.clearSelection();
nq+=1;
String ans=selecteditem();
cq-=checkans(ans);
try
Class.forName("java.sql.Driver");
java.sql.Connection
con=DriverManager.getConnection("jdbc:mysql://localhost/Quiz","root","");
java.sql.Statement st=con.createStatement();
for(int i=0;i<=(qn-2);i++)
rs.next();
if((qn-2)==0)
nxt.setVisible(true);
qlabel.setText(rs.getString(1));
opt1.setText(rs.getString(2));
opt2.setText(rs.getString(3));
opt3.setText(rs.getString(4));
opt4.setText(rs.getString(5));
qn-=1;
catch(Exception e)
System.out.println(e);
buttonGroup1.clearSelection();
nq-=1;
cq+=checkans(selecteditem());
nq+=1;
Result_Quiz f=new Result_Quiz();
f.setVisible(true);
this.dispose();
Frame: Result_Quiz
Coding for Login_Quiz:
import java.sql.*;
import javax.swing.JOptionPane;
//Global Variables
double score=(Question_Quiz.cq*100)/Question_Quiz.nq;
switch (Home_Quiz.topic) {
case "javaquestion":
java1=(int) score;
break;
case "mysqlquestion":
sql1=(int) score;
break;
case "htmlquestion":
html1=(int) score;
break;
default:
break;
DefaultTableModel model=(DefaultTableModel)jTable1.getModel();
model.addRow(new Object[]{java1+"%",html1+"%",sql1+"%"});
scrtxt.setText(Question_Quiz.cq+"/"+Question_Quiz.nq);
System.exit(0);
Question_Quiz.cq=0;
Question_Quiz.nq=0;
Question_Quiz.qn=1;
f.setVisible(true);
this.dispose();
BIBILIOGRAPHY
In order to work on this project titled Computer Quiz, the
following books and literature are referred by me during the various
phases of development of the project.
1. MySQL, Black Book Steven Holzner
2. Informatics Practices for class XII Sumita Arora
3. http://www.mysql.org/
4. http://www.netbeans.org/
5. Various Websites of Discussion Forum and Software
Development activities