You are on page 1of 88

Abstract

This document is meant for describing all the features and procedures that were followed while developing the system. This document specially mentions the details of the project how it was developed, the primary requirement, as well as various features and functionalities of the project and the procedures followed in achieving these objectives. Quiz Application System forms the lifeline of the Educational Institutes to the functioning of the Examination. It is very essential for an Institute to handle the Examinations and their results. It is very useful for an Institute to test its students continuously for their mutual development. This system is helpful for conducting (M.C) Multiple Choice Examinations which can be conducted regularly as well as for surprise tests and provides immediate results saving the precious time of faculties to check the papers and prepare mark sheets. The IT initiatives have encouraged various Organizations to develop systems to facilitate their day to day operations. The Quiz Application System will include various Courses (IT, Commerce, Science, etc) and subjects for conducting examinations. This system helps in conducting examinations quickly and can thus help in saving time and the operations will be carried out efficiently. With the effective use, any Institute can apply the Quiz application System for conducting quick examinations and getting better results in less time.

INTRODUCTION

Project Description
The project Quiz Application is developed in Java, which mainly focuses on basic Exam operations. Quiz Application is a windows application written for Windows operating systems, designed to help users to write exams. The software Quiz Application has 3 main modules. Login Module Insertion to Database Module Extracting from Database Module

PURPOSE
The purpose of Quiz test simulator is to take quiz in an efficient manner and no time wasting for checking the paper. The main objective of on-line test simulator is to efficiently evaluate the candidate thoroughly through a fully automated system that not only saves lot of time but also gives fast results. For students they give papers according to their convenience and time and there is no need of using extra thing like paper, pen etc.

Study Weaknesses Of Current System Current System


The Current system of examinations is highly complicated and expensive. Whenever exams are to be conducted there are various tasks that have to be done again and again. Setting question paper Checking for errors Printing question papers Scheduling Exams Conducting Exams

Checking Answer Papers Preparing Result Charts Solving Question Papers

Weaknesses in Current System


The current system is as mentioned earlier very complicated and expensive as compared to the new system. It also wastes the precious time of the faculties which can then be used in solving student queries and helping them improvise. Taking surprise tests of students is also not feasible in the current system as planning for the exam and checking answer papers takes a lot of time and thus cannot be completed on schedule. It also has no measures to prevent students from copying the answers rather than printing different sets of question papers which in turn can result expensive.

System Overview
As Faculties are humans and so prone to errors, there can be mistakes in checking answer papers, calculating marks and the result charts prepared may also have these errors. Only preventive measures are taking a double check to ensure these errors dont happen which would again require extra time and may also result in a mentally tired faculty. After the exams have been conducted the faculty has to provide solutions to the questions asked in exam. It would mean extra time and extra work for the faculty and also result in extra expenses of stationary. Thus, the current system is in every way ineffective for conducting examinations in these days when time is more costly than anything and they also pose a threat to the environment when we are amidst a global crisis and in the need of a Green Revolution.

Feasibility Study
A key part of the preliminary investigation that reviews anticipated costs and benefits and recommends a course of action based on operational, technical, economic, and time factors. The purpose of the study is to determine if the systems request should proceed further.

Does

the

New

System

Contribute

to

the

Overall

Objectives

of

the

Organization? The new system would contribute to the overall objectives to of the organization. It would provide a quick, error free and cost effective solution to the current process. It would provide a solution to many issues in the current system. As the new system is flexible and scalable it can also be upgraded and extended to meet other complex requirements which may be raised in the future. However it is up to the organization to upgrade or extend it. Can the New System be Implemented Using Current Technology? The organization has a computer laboratory which has about 50 machines connected by Internet Lan and managed by a server. It would be very easy to set up the system in the current environment as the application is web based it does not require to be installed on every machine

Features of the New System


The new system has been designed as per the user requirements so as to fulfill almost all them. Quick Scheduling Exams can be created very quickly as compared to the existing system as it allows the use of previously entered questions to be used again. It saves time required to get the question papers printed and distributed before the students are allowed to appear for the examination. Questions entered once can be accessed by students as soon as they login to their account. Immediate Results and Solutions One of the most important draw backs of the current system is that the faculties are required to check the answer papers which is again a lengthy process and prone to errors. The new system will generate the result as soon as the test is finished by the user and will also store it in the database for further usage. The solution is also available as soon as the questions are inserted in the database.

Easy to Store and Retrieve Information The new system makes it easy to store and retrieve information as required and does not involve storing information in separate sheets or papers. It thus saves data management problems faced in the current system as it has a Database Management System of it own which allows 33 reports to be generated when needed. Cost Effective One of the main reasons of the new system is its cost effectiveness. It saves the amount spend on stationary as well as overall cost of conducting an examination which also involves paying supervisors, paper checkers, question paper printers etc.

SYSTEM ANALYSIS

EXISTING SYSTEM:

System Analysis is a detailed study of the various operations performed by a system and their relationships within and outside of the system. Here the key question is what all problems exist in the present system? What must be done to solve the problem? Analysis begins when a user or manager begins a study of the program using existing system. During analysis, data collected on the various files, decision points and transactions handled by the present system. The commonly used tools in the system are Data Flow Diagram, interviews, etc. Training, experience and common sense are required for collection of relevant information needed to develop the system. The success of the system depends largely on how clearly the problem is defined, thoroughly investigated and properly carried out through the choice of solution. A good analysis model should provide not only the mechanisms of problem understanding but also the frame work of the solution. Thus it should be studied thoroughly by collecting data about the system. Then the proposed system should be analyzed thoroughly in accordance with the needs.

PROPOSED SYSTEM:

Proposed system is an Quiz Application. According to designate we can create an account, writing exam using that account. Our proposed system has the following advantages. User friendly Interface Fast access to database Less error Storage Capacity

SYSTEM DESIGN

OUTPUT FORM DESIGN


Computer output is the most important and direct source of information to the user. Efficient, intelligible output design should improve the system relationship with the user and help in decision-making. The outputs provide in the system are the softcopy report available for printing. Printouts should be designed around the output requirement of the user. The output devices to consider depend on the factor such as compatibility of the device with the system, response time requirement and number of copies needed.

INPUT FORM DESIGN


Input Design is the process of converting user originated computer based format. Inaccurate input data are the most common cause of errors in data processing .Errors entered by data entry operators can be controlled by input design. The goal of designing input data is to make data entry as easy, logical and free from errors as far as possible. In this system, the input screens are developed according to the user requirements.

DATABASE DESIGN
The general theme behind a database is to handle information as an integrated whole. A database is a collection of interrelated data stored with minimum redundancy to serve many users quickly and effectively. After designing the input and output, the analyst must concentrate on database design or how data should be organized around user requirements. The general objective is to make information access, easy quick, inexpensive and flexible for other users. During database design the following objectives are concerned: Controlled Redundancy Easy to learn and use More information and low cost Accuracy Integrity

Database name: Quiz

Beginner, Intermediate and Expert questions table

Exam Table

Admin Table

User info Table

DATA FLOW DIAGRAM

A data-flow diagram (DFD) is a graphical representation of the "flow" of data through an information system. DFDs can also be used for the visualization of data processing (structured design).On a DFD, data items flow from an external data source or an internal data store to an internal data store or an external data sink, via an internal process. A DFD provides no information about the timing or ordering of processes, or about whether processes will operate in sequence or in parallel. It is therefore quite different from a flowchart, which shows the flow of control through an algorithm, allowing a reader to determine what operations will be performed, in what order, and under what circumstances, but not what kinds of data will be input to and output from the system, nor where the data will come from and go to, nor where the data will be stored
Login (all of which are shown on a DFD). Registration New User

Admin Phase
Upload the Questions Get the Report

Login Exam

Participant Phase
Next Submit

Start

Exit

System Architecture
A system architecture or systems architecture is the conceptual design that defines the structure and/or behavior of a system. An architecture description is a formal description of a system, organized in a way that supports reasoning about the structural properties of the system. It defines the system components or building blocks and provides a plan from which products can be procured, and systems developed, that will work together to implement the overall system. This may enable one to manage investment in a way that meets business needs. The fundamental organization of a system, embodied in its components, their relationships to each other and the environment, and the principles governing its design and evolution. The composite of the design architectures for products and their life cycle processes. A representation of a system in which there is a mapping of functionality onto hardware and software components, a mapping of the software architecture onto the hardware architecture, and human interaction with these components. An allocated arrangement of physical elements which provides the design solution for a consumer product or life-cycle process intended to satisfy the requirements of the functional architecture and the requirements baseline. Architecture is the most important, pervasive, top-level, strategic inventions, decisions, and their associated rationales about the overall structure (i.e., essential elements and their relationships) and associated characteristics and behavior.

Database

Login Admin

Upload Questions

User Registration

Report Creation

Attend Exam

Use Case Diagram A use case diagram in the Unified Modeling Language (UML) is a type of behavioral diagram defined by and created from a Use-case analysis. Its purpose is to present a graphical overview of the functionality provided by a system in terms of actors, their goals (represented as use cases), and any dependencies between those use cases. The main purpose of a use case diagram is to show what system functions are performed for which actor. Roles of the actors in the system can be depicted.

Upload Questions

Register User Admin Create and Print the Result Reports Participant

Attend the Quiz

Sequence Diagram A sequence diagram in Unified Modeling Language (UML) is a kind of interaction diagram that shows how processes operate with one another and in what order. It is a construct of a Message Sequence Chart. Sequence diagrams are sometimes called Event-trace diagrams, event scenarios, and timing diagrams. A sequence diagram shows, as parallel vertical lines (lifelines), different processes or objects that live simultaneously, and, as horizontal arrows, the messages exchanged

Login

Admin

Exam

Database

Retrieve between them, in the order in which they occur. This allows the specification of simple Admin Randomly runtime scenarios in a graphical manner. Participant Questions

Send Questions
Upload Questions

Register User

Report Request Report Displyed

SYSTEM IMPLEMENTATION

ABOUT OPERATING SYSTEM


Windows XP is a line of operating systems developed by Microsoft for use on general-purpose computer systems, including home and business desktops, notebook computers, and media centers. The letters "XP" stand for experience. Windows XP is the successor to both Windows 2000 and Windows Me, and is the first consumer-oriented operating system produced by Microsoft to be built on the Windows NT kernel and architecture

The most common editions of the operating system are Windows XP Home Edition, which is targeted at home users, and Windows XP Professional, which has additional features such as support for Windows Server domains and two physical processors, and is targeted at power users and business clients. Windows XP Tablet PC Edition is designed to run the ink-aware Tablet PC platform. Two separate 64-bit versions of Windows XP were also released, Windows XP 64-bit Edition for IA-64 (Itanium) processors and Windows XP Professional x64 Edition for x86-64 processors. Windows XP is known for its improved stability and efficiency over previous versions of Microsoft Windows. It presents a significantly redesigned graphical user interface, a change Microsoft promoted as more user-friendly than previous versions of Windows. New software management capabilities were introduced to avoid the "DLL hell" that Plagued older consumer versions of Windows. It is also the first version of Windows to use product activation to combat software piracy, a restriction

That did not sit well with some users and privacy advocates. Windows XP has also been criticized by some users for security vulnerabilities, tight Integration of applications such as Internet Explorer and Windows Media Player, and for aspects of its user interface.

ABOUT THE LANGUAGE

Java is a programming language developed by Sun Microsystems and is based on the concepts of C and C++. The syntax for Java is similar to C.

HISTORY OF JAVA
In November 1995, Sun Microsystems introduced a new

programming language to the world- Java. Until then the word Java could only mean an island in Indonesia or a particular blend of coffee. Though its initial development began as early as 1991, it took some time for the final working version to reach the market. The basic objective behind developing the language was to create software that could be embedded in consumer electronic devices. Efforts were taken to produce a portable, platform in dependable language, and the result of this led to the birth of a new language. James Gosling and a team of other programmers were the pioneers behind this development. It was initially called Oak but was later renamed to Java. Slowly but gradually it was found that Internet users had similar problems of portability and platform independence and were looking for software that could address these issues. Java language was found to be small, secure and portable. Thus Java, which was initially developed to cater To small-scale problems, was found capable of addressing large-scale problems across the Internet. FEATURES OF JAVA The Java Language is

Simple Object Oriented Platform-Independent Robust Secure Distributed Multithreaded

Simple
The designers of Java were trying to develop a language that

a programmer could learn quickly. They also wanted the language to be familiar to most programmers, for ease of migration. Hence the Java designers removed a number of complex features that existed in C and C++. Java does not have features such as pointer manipulation, operator overloading etc. Java does not use the go to statement, or header filed. Constructs like struct and union have also been removed from Java.

Platform-Independent

Platform-independence refers to the ability of the program to migrate from one computer to another without any Difficulty. Java is platform independent at the source level as well as at the binary level. Java is strongly typed language. This means that you need to declare the type for any variable. The java data types are consistent across all the

development platforms. Java has its own foundation class libraries. This allows the programmer to write code that can be mobbed from one machine to another, with out having to rewrite it. In short, platform independence at the source level allows the user to move the source code from one system to another, compile the code, and run it clearly on the system. Platform independence at the binary level allows the user to run the compiled binary file on multiple platforms without recompiling the code.

Robust
Java is strictly a typed language. Hence it requires explicit method declaration. Java checks your code at the time of compilation and also at the time of interpretation. Thus it eliminates certain types of programming errors. Java does not have pointers and pointer arithmetic. It checks all access to arrays and strings at the runtime. It also checks the casts of objects from one type to another at runtime. In traditional programming environments, the programmer had to manually allocate memory. By the end of the program, the programmer had to explicitly free this memory. Problems arose when the programmer forgot to de allocate the memory. In Java the programmer doesnt need to bother about memory de allocation. Its done automatically, as Java provides Garbage collections for un used objects. Javas exception handling feature simplifies the task of error handling and recovery.

Secure:

Viruses are a great cause of worry in the world of computers. Prior to the advent of Java, programmers had to first scan files, before downloading and executing them. Often this precaution was no guarantee against viruses. Also there were many malicious programs that programmers need to look out for. These programs could search the contents of your local file system and retrieve sensitive data. Java provides a controlled environment for the execution of the program. It never assumes that the code is safe for execution. And since java is more than a programming language, it provides several layers of security control. In the first layer, the data and methods are encapsulated in the class. They can be accessed only through the interface that the class provides. Java does not allow any pointer arithmetic. Hence it does not allow direct access to the memory. It disallows array overflow, prevents reading memory out of bounds, and provides garbage collection. All these features help minimize safety and portability problems. In the second layer the compiler ensures that the code is safe and follows the protocols set by Java before compiling the code. The third layer is safety provided by the Interpreter. The verifier thoroughly screens the byte codes to ensure they obey the rules before executing them. The fourth layer takes care of loading the classes. The class loader ensures that the class doesnt violate the access restrictions, before loading it to the system.

Distributed
Java can be used to develop applications that are portable across multiple platforms and operating systems. Java is designed to support network applications.

Multithreaded
Java programs use a process called multithreading

to perform many tasks simultaneously. Java provides the master solution for synchronizing multiple processes. The built in support for threads enables interactive applications on the internet to run simultaneously

SYSTEM CONFIGURATION

System Requirements Hardware Requirements


SYSTEM HARD DISK MONITOR RAM KEYBOARD : : : : : Pentium IV 2.4 GHz 40 GB 15 VGA colour 256 MB 110 keys enhanced.

Software Requirements

Operating system Front End Back End Connector GUI for Back end

: : : : :

Windows XP or Above Java 6 or above MySQL 5.0.41 MySQLJ connector 5 or above Heidi SQL 3.2

ABOUT MS-ACCESS

Access is a relational database program .Access is used to enter, edit, and analyze lists of data. Relational databases minimize redundant data Advantages of Access Duplicate data is minimized Information is more accurate

Data entry is faster and easier Information can be viewed and sorted in multiple ways. Information is more secure Information can be shared among several users Information retrieval is faster and easier

APPENDIX

SOURCE CODE
import java.awt.Dimension; import com.jtattoo.plaf.*; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JRExporterParameter; import net.sf.jasperreports.engine.JasperCompileManager; import net.sf.jasperreports.engine.JasperExportManager; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.engine.export.JRXlsExporter; import net.sf.jasperreports.view.JRViewer; import net.sf.jasperreports.view.JasperViewer;

import java.awt.Component; import java.awt.EventQueue; import java.awt.Rectangle; import java.awt.Toolkit; import javax.swing.JFrame; import javax.swing.JDesktopPane; import java.awt.BorderLayout; import javax.swing.ButtonGroup; import javax.swing.JDialog; import javax.swing.JMenuBar; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.Color; import java.awt.event.WindowStateListener; import java.awt.event.WindowEvent; import java.awt.GridLayout; import com.jgoodies.forms.layout.FormLayout; import com.jgoodies.forms.layout.ColumnSpec; import com.jgoodies.forms.layout.RowSpec; import com.jgoodies.forms.factories.FormFactory; import java.awt.CardLayout; import javax.swing.BoxLayout; import java.awt.GridBagLayout; import java.awt.GridBagConstraints; import java.awt.event.WindowAdapter; import java.awt.SystemColor; import javax.swing.ImageIcon; import javax.swing.JPanel; import javax.swing.JLabel; import java.awt.Insets; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.text.SimpleDateFormat; import java.util.HashMap;

import java.util.Locale; import javax.swing.JButton; import javax.swing.JTextField; import javax.swing.JPasswordField; import javax.swing.JRadioButton; import javax.swing.JSeparator; public class AW { static JFrame frmQuizApplicationAdministrator; private static JTextField tUser; private static JPasswordField tPass; private static JMenuBar menuBar; private static ButtonGroup bg; private static java.util.Date currDate = new java.util.Date (); //Creating Object. private static SimpleDateFormat sdf = new SimpleDateFormat ("dd MMM yy", Locale.getDefault()); //Changing Format. private static String d = sdf.format (currDate); static Connection con; static Statement st; static ResultSet rs1,rs2; static JLabel lUser; static DBC db=new DBC(); /** * Launch the application. */ public static void main(String[] args) { SplashScreen sp= new SplashScreen(5000); boolean s=sp.showSplashAndExit(); EventQueue.invokeLater(new Runnable() { public void run() { try { JFrame.setDefaultLookAndFeelDecorated(true); JDialog.setDefaultLookAndFeelDecorated(true); //JFrame frmQuizApplicationAdministrator; try { //UIManager.setLookAndFeel("com.jtattoo. plaf.aluminium.AluminiumLookAndFeel"); UIManager.setLookAndFeel("com.jtattoo.plaf.graphite.GraphiteLookAndFeel");

//UIManager.setLookAndFeel("ch.randelsho fer.quaqua.QuaquaLookAndFeel"); //UIManager.setLookAndFeel("napkin.Napk inLookAndFeel"); //UIManager.setLookAndFeel("com.seaglas slookandfeel.SeaGlassLookAndFeel"); } catch(ClassNotFoundException e){ e.printStackTrace(); } AW window = new AW(); Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize(); Rectangle winDim = frmQuizApplicationAdministrator.getBounds(); frmQuizApplicationAdministrator.setLocation((screenDim.width - winDim.width) / 2, (screenDim.height - winDim.height) / 2); frmQuizApplicationAdministrator.setMaximumSize(screenDim); frmQuizApplicationAdministrator.setExtendedState(JFrame.MAXIMIZED_BOTH); GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[]{0, 0}; gridBagLayout.rowHeights = new int[]{0, 0, 387, 25, 0}; gridBagLayout.columnWeights = new double[]{1.0, Double.MIN_VALUE}; gridBagLayout.rowWeights = new double[]{1.0, 1.0, 1.0, 0.0, Double.MIN_VALUE}; frmQuizApplicationAdministrator.getContentPane().setLayout(gridBagLayout); final JDesktopPane Desktop = new JDesktopPane(); Desktop.setForeground(UIManager.getColor("Button.disabledForeground")); Desktop.setBackground(UIManager.getColor("Button.shadow")); Desktop.setLayout(null); final GridBagConstraints gbc_Desktop = new GridBagConstraints(); gbc_Desktop.insets = new Insets(0, 0, 5, 0);

gbc_Desktop.gridheight = 3; gbc_Desktop.fill = GridBagConstraints.BOTH; gbc_Desktop.gridx = 0; gbc_Desktop.gridy = 0; frmQuizApplicationAdministrator.getContentPane().add(Desktop, gbc_Desktop); final JPanel panel = new JPanel(); panel.setBounds(305, 130, 464, 317); panel.setBackground(Color.WHITE); panel.setOpaque(false); Desktop.add(panel); GridBagLayout gbl_panel = new GridBagLayout(); gbl_panel.columnWidths = new int[]{50, 50, 50, 50, 50, 50, 50, 50, 42, 50, 0}; gbl_panel.rowHeights = new int[]{25, 25, 25, 25, 25, 25, 25, 25, 25, 0}; gbl_panel.columnWeights = new double[]{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE}; gbl_panel.rowWeights = new double[]{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE}; panel.setLayout(gbl_panel); JLabel lblNewLabel = new JLabel("User Name"); GridBagConstraints gbc_lblNewLabel = new GridBagConstraints(); gbc_lblNewLabel.gridwidth = 2; gbc_lblNewLabel.fill = GridBagConstraints.VERTICAL; gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel.gridx = 1; gbc_lblNewLabel.gridy = 1; panel.add(lblNewLabel, gbc_lblNewLabel); tUser = new JTextField(); GridBagConstraints gbc_tUser = new GridBagConstraints(); gbc_tUser.fill = GridBagConstraints.BOTH; gbc_tUser.insets = new Insets(0, 0, 5, 5); gbc_tUser.gridwidth = 5; gbc_tUser.gridx = 4; gbc_tUser.gridy = 1; panel.add(tUser, gbc_tUser); tUser.setColumns(10); JLabel lblNewLabel_1 = new JLabel("Password");

GridBagConstraints gbc_lblNewLabel_1 = new GridBagConstraints(); gbc_lblNewLabel_1.gridwidth = 2; gbc_lblNewLabel_1.fill = GridBagConstraints.VERTICAL; gbc_lblNewLabel_1.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel_1.gridx = 1; gbc_lblNewLabel_1.gridy = 3; panel.add(lblNewLabel_1, gbc_lblNewLabel_1); tPass = new JPasswordField(); tPass.setEchoChar('*'); GridBagConstraints gbc_tPass = new GridBagConstraints(); gbc_tPass.fill = GridBagConstraints.BOTH; gbc_tPass.insets = new Insets(0, 0, 5, 5); gbc_tPass.gridwidth = 5; gbc_tPass.gridx = 4; gbc_tPass.gridy = 3; panel.add(tPass, gbc_tPass); final JRadioButton RAdmin = new JRadioButton("Administrator"); RAdmin.setBackground(Color.WHITE); RAdmin.setOpaque(false); GridBagConstraints gbc_RAdmin = new GridBagConstraints(); gbc_RAdmin.anchor = GridBagConstraints.NORTHEAST; gbc_RAdmin.insets = new Insets(0, 0, 5, 5); gbc_RAdmin.gridwidth = 2; gbc_RAdmin.gridx = 3; gbc_RAdmin.gridy = 5; panel.add(RAdmin, gbc_RAdmin);

final JRadioButton RPart = new JRadioButton("Participant"); RPart.setBackground(Color.WHITE); RPart.setOpaque(false); GridBagConstraints gbc_RPart = new GridBagConstraints(); gbc_RPart.anchor = GridBagConstraints.NORTH; gbc_RPart.insets = new Insets(0, 0, 5, 5); gbc_RPart.gridwidth = 2;

gbc_RPart.gridx = 6; gbc_RPart.gridy = 5; panel.add(RPart, gbc_RPart); bg= new ButtonGroup(); bg.add(RAdmin); bg.add(RPart); JButton btnLogin = new JButton("Login"); btnLogin.setBackground(Color.WHITE); btnLogin.setIcon(null); GridBagConstraints gbc_btnLogin = new GridBagConstraints(); gbc_btnLogin.gridwidth = 2; gbc_btnLogin.anchor = GridBagConstraints.NORTH; gbc_btnLogin.fill = GridBagConstraints.HORIZONTAL; gbc_btnLogin.insets = new Insets(0, 0, 5, 5); gbc_btnLogin.gridx = 1; gbc_btnLogin.gridy = 7; panel.add(btnLogin, gbc_btnLogin); JButton btnCancel = new JButton("Cancel"); btnCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); GridBagConstraints gbc_btnCancel = new GridBagConstraints(); gbc_btnCancel.anchor = GridBagConstraints.NORTH; gbc_btnCancel.fill = GridBagConstraints.HORIZONTAL; gbc_btnCancel.insets = new Insets(0, 0, 5, 5); gbc_btnCancel.gridwidth = 2; gbc_btnCancel.gridx = 4; gbc_btnCancel.gridy = 7; panel.add(btnCancel, gbc_btnCancel); JButton btnSignup = new JButton("Signup"); btnSignup.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { Registration r=new Registration(); Desktop.add(r);

r.setVisible(true); } }); GridBagConstraints gbc_btnSignup = new GridBagConstraints(); gbc_btnSignup.gridwidth = 2; gbc_btnSignup.insets = new Insets(0, 0, 5, 5); gbc_btnSignup.anchor = GridBagConstraints.NORTH; gbc_btnSignup.fill = GridBagConstraints.HORIZONTAL; gbc_btnSignup.gridx = 7; gbc_btnSignup.gridy = 7; panel.add(btnSignup, gbc_btnSignup); JLabel label = new JLabel(""); label.setIcon(new ImageIcon(AW.class.getResource("/Images/kqh10ol3e6r93xm.jpg"))); label.setBounds(0, 0, 1366, 655); Desktop.add(label); JPanel panel_1 = new JPanel(); panel_1.setLayout(null); panel_1.setBackground(SystemColor.textInactiveText); GridBagConstraints gbc_panel_1 = new GridBagConstraints(); gbc_panel_1.fill = GridBagConstraints.BOTH; gbc_panel_1.gridx = 0; gbc_panel_1.gridy = 3; frmQuizApplicationAdministrator.getContentPane().add(panel_1, gbc_panel_1); final JLabel LST = new JLabel(""); LST.setBounds(319, 5, 74, 14); panel_1.add(LST); JLabel label_1 = new JLabel("Welcome"); label_1.setBounds(10, 5, 61, 14); panel_1.add(label_1); lUser = new JLabel(""); lUser.setBounds(66, 5, 243, 14); panel_1.add(lUser); JLabel label_3 = new JLabel("Today Date is");

label_3.setBounds(226, 5, 97, 14); panel_1.add(label_3); panel.setVisible(true); menuBar = new JMenuBar(); frmQuizApplicationAdministrator.setJMenuBar(menuBar); final JMenu mnNewMenu = new JMenu("Home"); menuBar.add(mnNewMenu); mnNewMenu.setMnemonic('H'); menuBar.setVisible(false); JMenuItem MIReg = new JMenuItem("Registration"); MIReg.setIcon(new ImageIcon(AW.class.getResource("/Images/1260821900_32 (25).png"))); MIReg.setMnemonic('R'); MIReg.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { Registration r=new Registration(); Desktop.add(r); r.setVisible(true); r.setBounds(0, 0, Desktop.getWidth(), Desktop.getHeight()); } }); mnNewMenu.add(MIReg); JMenuItem MIUpload = new JMenuItem("Upload Questions"); MIUpload.setIcon(new ImageIcon(AW.class.getResource("/Images/1260821921_32 (31).png"))); MIUpload.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { UploadQuestions u=new UploadQuestions(); Desktop.add(u); u.setVisible(true); u.setBounds(0, 0, Desktop.getWidth(), Desktop.getHeight()); } });

mnNewMenu.add(MIUpload); JMenuItem mntmQuit = new JMenuItem("Quit"); mntmQuit.setIcon(new ImageIcon(AW.class.getResource("/Images/1260821858_32 (18).png"))); mntmQuit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); JMenuItem mntmSignOut = new JMenuItem("Sign Out"); mntmSignOut.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { menuBar.setVisible(false); panel.setVisible(true); } }); mnNewMenu.add(mntmSignOut); JSeparator separator = new JSeparator(); mnNewMenu.add(separator); mnNewMenu.add(mntmQuit); final JMenu mnReports = new JMenu("Reports"); mnReports.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { } }); menuBar.add(mnReports); JMenuItem mntmBeginnerResults = new JMenuItem("Beginner Results"); mntmBeginnerResults.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JasperReport Breport; JasperPrint BPrint; try { con=db.getConnection();

HashMap jp=new HashMap(); Breport=JasperCompileManager.compileReport("\\Quiz System\\Reports\\Begin_Result.jrxml"); BPrint=JasperFillManager.fillReport(Breport,jp,con); JasperViewer.viewReport(BPrint, false); } catch (SQLException e1) { // TODO Autogenerated catch block e1.printStackTrace(); } catch (ClassNotFoundException e1) { // TODO Autogenerated catch block e1.printStackTrace(); } catch(Exception ex) { ex.printStackTrace(); } } }); mnReports.add(mntmBeginnerResults); JMenuItem mntmNewMenuItem = new JMenuItem("Intermediate Results"); mntmNewMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { JasperReport Breport; JasperPrint BPrint; try { con=db.getConnection(); HashMap jp=new HashMap(); Breport=JasperCompileManager.compileReport("\\Quiz System\\Reports\\Inter_Result.jrxml");

BPrint=JasperFillManager.fillReport(Breport,jp,con); JasperViewer.viewReport(BPrint, false); } catch (SQLException e1) { // TODO Autogenerated catch block e1.printStackTrace(); } catch (ClassNotFoundException e1) { // TODO Autogenerated catch block e1.printStackTrace(); } catch(Exception ex) { ex.printStackTrace(); } } }); mnReports.add(mntmNewMenuItem); JMenuItem mntmNewMenuItem_1 = new JMenuItem("Expert Results"); mntmNewMenuItem_1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { JasperReport Breport; JasperPrint BPrint; try { con=db.getConnection(); HashMap jp=new HashMap(); Breport=JasperCompileManager.compileReport("\\Quiz System\\Reports\\Expert_Result.jrxml"); BPrint=JasperFillManager.fillReport(Breport,jp,con); JasperViewer.viewReport(BPrint, false);

} catch (SQLException e1) { // TODO Autogenerated catch block e1.printStackTrace(); } catch (ClassNotFoundException e1) { // TODO Autogenerated catch block e1.printStackTrace(); } catch(Exception ex) { ex.printStackTrace(); } } }); mnReports.add(mntmNewMenuItem_1); final JMenu mnExam = new JMenu("Exam"); menuBar.add(mnExam); JMenuItem mntmStartExam = new JMenuItem("Exam"); mntmStartExam.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { Quiz_Test q=new Quiz_Test(); Desktop.add(q); q.setVisible(true); //q.setBounds(0,0,Desktop.getWidth(),Desktop.getHeight()); q.setLocation(((Desktop.getWidth()q.getWidth())/2),((Desktop.getHeight()-q.getHeight())/2)); //q.setLocation(50,50); } }); mnExam.add(mntmStartExam); btnLogin.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { try {

String user=tUser.getText().trim(); String password=new String(tPass.getPassword()); boolean ad=RAdmin.isSelected(); boolean part=RPart.isSelected(); con=db.getConnection(); st=con.createStatement(); if(part) { boolean flag=db.getLogin(user,password); if(flag) { menuBar.setVisible(true); mnNewMenu.setEnabled(false); mnReports.setEnabled(false); mnExam.setEnabled(true); panel.setVisible(false); lUser.setText(user); LST.setText(d); } } else if(ad) { rs1=st.executeQuery("select * from login where user='"+user+"' and pass='"+password+"'"); if(rs1.next()) { menuBar.setVisible(true); panel.setVisible(false); lUser.setText(user); LST.setText(d); } }

} catch (SQLException e) { // TODO Autogenerated catch block e.printStackTrace(); } catch (ClassNotFoundException e) { // TODO Autogenerated catch block e.printStackTrace(); } } private Component getParent() { // TODO Auto-generated method stub return null; } });

window.frmQuizApplicationAdministrator.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } });

} /** * Create the application. */ public AW() { initialize(); }

String user() { String mail=lUser.getText(); return mail; } /** * Initialize the contents of the frame. */ private void initialize() { frmQuizApplicationAdministrator = new JFrame(); frmQuizApplicationAdministrator.setTitle("Quiz Application Administrator Window"); frmQuizApplicationAdministrator.addWindowListener(new WindowAdapter() { private Dimension screenDim; @Override public void windowActivated(WindowEvent arg0) { screenDim = Toolkit.getDefaultToolkit().getScreenSize(); tUser.requestFocus(); } }); frmQuizApplicationAdministrator.addWindowStateListener(new WindowStateListener() { public void windowStateChanged(WindowEvent arg0) { } }); frmQuizApplicationAdministrator.setBounds(100, 100, 681, 526); frmQuizApplicationAdministrator.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE ); } }

Quiz Test
import java.awt.BorderLayout; import java.awt.Container; import java.awt.Dimension; import java.awt.EventQueue;

import java.awt.Frame; import java.awt.Label; import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ButtonGroup; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JInternalFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JTextField; import javax.swing.JTextArea; import javax.swing.JRadioButton; import javax.swing.SwingConstants; import java.awt.Font; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.swing.event.InternalFrameAdapter; import javax.swing.event.InternalFrameEvent; import java.awt.GridBagLayout; import java.awt.GridBagConstraints; import java.awt.Insets; import java.awt.Color; import javax.swing.ImageIcon;

import javax.swing.JPanel; import net.miginfocom.swing.MigLayout;

public class Quiz_Test extends JInternalFrame { /** * */ private static final long serialVersionUID = 1L; static Quiz_Test frame; ButtonGroup bg; AW a=new AW(); DBC db=new DBC(); Connection con; Statement st; PreparedStatement pst,pst1; ResultSet rs1,rs2,rs3; int qn=0,Beg=10,Inter=20,Expert=30,ans=0; String o1,o2="",o3; private JPanel panel; static JLabel Sta; private JLabel label_1; private JLabel lqno1; private JLabel label_3; private JLabel lbca; private JTextArea tqd; private JRadioButton opt1; private JRadioButton opt2; private JRadioButton opt3; private JRadioButton opt4;

private JLabel s5; private JButton btnStart; static JButton btnNext; private JButton btnCancel; private JButton btnSubmit; static JLabel lbt; private JLabel lblTechnicalKnowledgTest;

/** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { frame = new Quiz_Test(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public Quiz_Test() { setRootPaneCheckingEnabled(false);

setResizable(true); //setMaximum(false); setClosable(true); getContentPane().setBackground(new Color(112, 128, 144)); addInternalFrameListener(new InternalFrameAdapter() { @Override public void internalFrameActivated(InternalFrameEvent arg0) { lbca.setVisible(false); String mail=a.user().trim(); String NC="Not Completed"; try { con=db.getConnection(); st=con.createStatement(); rs1=st.executeQuery("select MailID,Begin_ST,Inter_ST,Expert_ST from exam where MailID='"+mail+"'"); if(rs1.next()) { String s=rs1.getString("Begin_ST"); String s1=rs1.getString("Inter_ST"); String s2=rs1.getString("Expert_ST"); if(s.equals("Not Completed")) { Sta.setText("Beginner"); } else s1.equals("Not Completed")) { Sta.setText("Intermediate"); if(s.equals("Completed") &&

} else s2.equals("Not Completed")) { Sta.setText("Expert"); } else { JOptionPane.showMessageDialog(getParent(), "You have completed the Test ", "Result not availabale", 0); } } else { Sta.setText("Beginner"); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); setTitle("Knowledge Validation Area"); setBounds(100, 100, 886, 573); if(s1.equals("Completed")&&

final Timer1 t=new Timer1(9,60); final Timer1 t1=new Timer1(14,60); final Timer1 t2=new Timer1(14,60); bg=new ButtonGroup(); getContentPane().setLayout(null); panel = new JPanel(); int h=getContentPane().getHeight(); int w=getContentPane().getWidth(); panel.setBounds(72,34,708,451); panel.setOpaque(false); getContentPane().add(panel); GridBagLayout gbl_panel = new GridBagLayout(); gbl_panel.columnWidths = new int[]{0, 91, 65, 0, 55, 35, 65, 44, 90, 93, 0, 131, 0}; gbl_panel.rowHeights = new int[]{0, 50, 34, 84, 31, 21, 21, 21, 30, 21, 34, 0, 23, 0}; gbl_panel.columnWeights = new double[]{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE}; gbl_panel.rowWeights = new double[]{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE}; panel.setLayout(gbl_panel); label_1 = new JLabel("Question No"); label_1.setForeground(Color.WHITE); label_1.setFont(new Font("Tahoma", Font.BOLD, 14)); GridBagConstraints gbc_label_1 = new GridBagConstraints(); gbc_label_1.anchor = GridBagConstraints.EAST; gbc_label_1.insets = new Insets(0, 0, 5, 5); gbc_label_1.gridx = 1;

gbc_label_1.gridy = 1; panel.add(label_1, gbc_label_1); lqno1 = new JLabel(""); lqno1.setFont(new Font("Tahoma", Font.PLAIN, 14)); GridBagConstraints gbc_lqno1 = new GridBagConstraints(); gbc_lqno1.fill = GridBagConstraints.HORIZONTAL; gbc_lqno1.insets = new Insets(0, 0, 5, 5); gbc_lqno1.gridx = 2; gbc_lqno1.gridy = 1; panel.add(lqno1, gbc_lqno1); Sta = new JLabel(""); Sta.setForeground(Color.WHITE); Sta.setFont(new Font("Tahoma", Font.BOLD, 16)); GridBagConstraints gbc_Sta = new GridBagConstraints(); gbc_Sta.fill = GridBagConstraints.BOTH; gbc_Sta.insets = new Insets(0, 0, 5, 5); gbc_Sta.gridwidth = 3; gbc_Sta.gridx = 6; gbc_Sta.gridy = 1; panel.add(Sta, gbc_Sta); label_3 = new JLabel("Question description"); label_3.setForeground(Color.WHITE); label_3.setFont(new Font("Tahoma", Font.BOLD, 14)); GridBagConstraints gbc_label_3 = new GridBagConstraints(); gbc_label_3.anchor = GridBagConstraints.SOUTHWEST; gbc_label_3.insets = new Insets(0, 0, 5, 5); gbc_label_3.gridwidth = 2; gbc_label_3.gridx = 1;

gbc_label_3.gridy = 2; panel.add(label_3, gbc_label_3); lbt = new JLabel(""); lbt.setHorizontalAlignment(SwingConstants.CENTER); lbt.setForeground(Color.WHITE); lbt.setFont(new Font("Tahoma", Font.BOLD, 24)); GridBagConstraints gbc_lbt = new GridBagConstraints(); gbc_lbt.gridwidth = 2; gbc_lbt.fill = GridBagConstraints.BOTH; gbc_lbt.insets = new Insets(0, 0, 5, 5); gbc_lbt.gridx = 9; gbc_lbt.gridy = 2; panel.add(lbt, gbc_lbt); tqd = new JTextArea(); tqd.setForeground(new Color(0, 102, 255)); tqd.setEditable(false); tqd.setBackground(new Color(211, 211, 211)); GridBagConstraints gbc_tqd = new GridBagConstraints(); gbc_tqd.fill = GridBagConstraints.BOTH; gbc_tqd.insets = new Insets(0, 0, 5, 5); gbc_tqd.gridwidth = 10; gbc_tqd.gridx = 1; gbc_tqd.gridy = 3; panel.add(tqd, gbc_tqd); opt1 = new JRadioButton(""); opt1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { o2=opt1.getText().toUpperCase();

} }); opt1.setForeground(Color.WHITE); opt1.setFont(new Font("Tahoma", Font.BOLD, 11)); opt1.setBackground(new Color(112, 128, 144)); opt1.setOpaque(false); bg.add(opt1); GridBagConstraints gbc_opt1 = new GridBagConstraints(); gbc_opt1.anchor = GridBagConstraints.NORTH; gbc_opt1.fill = GridBagConstraints.HORIZONTAL; gbc_opt1.insets = new Insets(0, 0, 5, 5); gbc_opt1.gridwidth = 9; gbc_opt1.gridx = 2; gbc_opt1.gridy = 5; panel.add(opt1, gbc_opt1); opt2 = new JRadioButton(""); opt2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { o2=opt2.getText().toUpperCase(); } }); opt2.setForeground(Color.WHITE); opt2.setFont(new Font("Tahoma", Font.BOLD, 11)); opt2.setBackground(new Color(112, 128, 144)); opt2.setOpaque(false); bg.add(opt2); GridBagConstraints gbc_opt2 = new GridBagConstraints(); gbc_opt2.anchor = GridBagConstraints.NORTH; gbc_opt2.fill = GridBagConstraints.HORIZONTAL; gbc_opt2.insets = new Insets(0, 0, 5, 5);

gbc_opt2.gridwidth = 9; gbc_opt2.gridx = 2; gbc_opt2.gridy = 6; panel.add(opt2, gbc_opt2); opt3 = new JRadioButton(""); opt3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { o2=opt3.getText().toUpperCase(); } }); opt3.setForeground(Color.WHITE); opt3.setFont(new Font("Tahoma", Font.BOLD, 11)); opt3.setBackground(new Color(112, 128, 144)); opt3.setOpaque(false); bg.add(opt3); GridBagConstraints gbc_opt3 = new GridBagConstraints(); gbc_opt3.anchor = GridBagConstraints.NORTH; gbc_opt3.fill = GridBagConstraints.HORIZONTAL; gbc_opt3.insets = new Insets(0, 0, 5, 5); gbc_opt3.gridwidth = 9; gbc_opt3.gridx = 2; gbc_opt3.gridy = 7; panel.add(opt3, gbc_opt3); opt4 = new JRadioButton(""); opt4.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { o2=opt4.getText().toUpperCase(); } });

opt4.setForeground(Color.WHITE); opt4.setFont(new Font("Tahoma", Font.BOLD, 11)); opt4.setBackground(new Color(112, 128, 144)); opt4.setOpaque(false); bg.add(opt4); GridBagConstraints gbc_opt4 = new GridBagConstraints(); gbc_opt4.anchor = GridBagConstraints.NORTH; gbc_opt4.fill = GridBagConstraints.HORIZONTAL; gbc_opt4.insets = new Insets(0, 0, 5, 5); gbc_opt4.gridwidth = 9; gbc_opt4.gridx = 2; gbc_opt4.gridy = 8; panel.add(opt4, gbc_opt4); s5 = new JLabel(""); GridBagConstraints gbc_s5 = new GridBagConstraints(); gbc_s5.fill = GridBagConstraints.BOTH; gbc_s5.insets = new Insets(0, 0, 5, 5); gbc_s5.gridwidth = 4; gbc_s5.gridx = 1; gbc_s5.gridy = 10; panel.add(s5, gbc_s5); lbca = new JLabel(""); GridBagConstraints gbc_lbca = new GridBagConstraints(); gbc_lbca.fill = GridBagConstraints.BOTH; gbc_lbca.insets = new Insets(0, 0, 5, 5); gbc_lbca.gridwidth = 3; gbc_lbca.gridx = 6; gbc_lbca.gridy = 10; panel.add(lbca, gbc_lbca);

btnSubmit = new JButton("Submit"); btnSubmit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { String level=Quiz_Test.Sta.getText().trim().toUpperCase(); if(level.equals("BEGINNER")) { BeginaddResult(); lqno1.setEnabled(false); lbt.setEnabled(false); tqd.setEnabled(false); opt1.setEnabled(false); opt2.setEnabled(false); opt3.setEnabled(false); opt4.setEnabled(false); btnNext.setEnabled(false); btnSubmit.setEnabled(false); } else if(level.equals("INTERMEDIATE")) { InterResult(); lqno1.setEnabled(false); lbt.setEnabled(false); tqd.setEnabled(false); opt1.setEnabled(false); opt2.setEnabled(false); opt3.setEnabled(false); opt4.setEnabled(false); btnNext.setEnabled(false); btnSubmit.setEnabled(false); }

else if(level.equals("EXPERT")) { ExpertResult(); lqno1.setEnabled(false); lbt.setEnabled(false); tqd.setEnabled(false); opt1.setEnabled(false); opt2.setEnabled(false); opt3.setEnabled(false); opt4.setEnabled(false); btnNext.setEnabled(false); btnSubmit.setEnabled(false); } } }); btnNext = new JButton("Next"); btnNext.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { String mail=a.user().trim(); String lb=lbca.getText().trim().toUpperCase(); if(o2.equals(lb)) { ans++; } else { }

qn=qn+1; String qry1="select * from beginner ORDER BY RAND()"; String qry2="select * from inter ORDER BY RAND()"; String qry3="select * from expert ORDER BY RAND()"; if(Sta.getText().trim().toUpperCase().equals("BEGINNER")) { if(qn<=Beg) { try { String Qdesc,Ropt1,Ropt2,Ropt3,Ropt4,Rca; String i1=new String(); con=db.getConnection(); pst=con.prepareStatement(qry1); rs1=pst.executeQuery(); while(rs1.next()) { Qdesc=rs1.getString("Question"); Ropt1=rs1.getString("opt1"); Ropt2=rs1.getString("opt2"); Ropt3=rs1.getString("opt3"); Ropt4=rs1.getString("opt4"); Rca=rs1.getString("Ca"); i1="0"+qn; lqno1.setText(i1); tqd.setText(Qdesc);

opt1.setText(Ropt1); opt2.setText(Ropt2); opt3.setText(Ropt3); opt4.setText(Ropt4); lbca.setText(Rca); } } catch (SQLException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } } else { BeginaddResult(); lqno1.setEnabled(false); lbt.setEnabled(false); tqd.setEnabled(false); opt1.setEnabled(false); opt2.setEnabled(false); opt3.setEnabled(false); opt4.setEnabled(false); btnNext.setEnabled(false); btnSubmit.setEnabled(false);

} else if(Sta.getText().trim().toUpperCase().equals("INTERMEDIATE")) { if(qn<=Inter) { try { String Qdesc,Ropt1,Ropt2,Ropt3,Ropt4,Rca; String i1=new String(); con=db.getConnection(); pst=con.prepareStatement(qry2); rs1=pst.executeQuery(); while(rs1.next()) { Qdesc=rs1.getString("Question"); Ropt1=rs1.getString("opt1"); Ropt2=rs1.getString("opt2"); Ropt3=rs1.getString("opt3"); Ropt4=rs1.getString("opt4"); Rca=rs1.getString("Ca"); i1="0"+qn; lqno1.setText(i1);

tqd.setText(Qdesc); opt1.setText(Ropt1); opt2.setText(Ropt2); opt3.setText(Ropt3); opt4.setText(Ropt4); lbca.setText(Rca); }

if(o2.equals(lbca.getText().trim().toUpperCase())) { ans++; } } catch (SQLException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } } else { InterResult(); lqno1.setEnabled(false); lbt.setEnabled(false); tqd.setEnabled(false);

opt1.setEnabled(false); opt2.setEnabled(false); opt3.setEnabled(false); opt4.setEnabled(false); btnNext.setEnabled(false); btnSubmit.setEnabled(false); } } else if(Sta.getText().trim().toUpperCase().equals("EXPERT")) { if(qn<=Inter) { try { String Qdesc,Ropt1,Ropt2,Ropt3,Ropt4,Rca; String i1=new String(); con=db.getConnection(); pst=con.prepareStatement(qry3); rs1=pst.executeQuery(); while(rs1.next()) { Qdesc=rs1.getString("Question"); Ropt1=rs1.getString("opt1"); Ropt2=rs1.getString("opt2"); Ropt3=rs1.getString("opt3"); Ropt4=rs1.getString("opt4"); Rca=rs1.getString("Ca");

i1="0"+qn; lqno1.setText(i1); tqd.setText(Qdesc); opt1.setText(Ropt1); opt2.setText(Ropt2); opt3.setText(Ropt3); opt4.setText(Ropt4); lbca.setText(Rca); }

if(o2.equals(lbca.getText().trim().toUpperCase())) { ans++; } } catch (SQLException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } } else { ExpertResult();

lqno1.setEnabled(false); lbt.setEnabled(false); tqd.setEnabled(false); opt1.setEnabled(false); opt2.setEnabled(false); opt3.setEnabled(false); opt4.setEnabled(false); btnNext.setEnabled(false); btnSubmit.setEnabled(false); } } else { lqno1.setEnabled(false); lbt.setEnabled(false); tqd.setEnabled(false); opt1.setEnabled(false); opt2.setEnabled(false); opt3.setEnabled(false); opt4.setEnabled(false); btnNext.setEnabled(false); btnSubmit.setEnabled(false); } } }); btnStart = new JButton("Start"); btnStart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) {

if(Sta.getText().trim().toUpperCase().equals("BEGINNER")) { t.start(); } else if(Sta.getText().trim().toUpperCase().equals("INTERMEDIATE")) { t1.start(); } else if(Sta.getText().trim().toUpperCase().equals("EXPERT")) { t2.start(); } else { JOptionPane.showMessageDialog(getParent(), "Thread starting error","Timer cant start",0); } btnStart.setEnabled(false); clear(); } }); GridBagConstraints gbc_btnStart = new GridBagConstraints(); gbc_btnStart.anchor = GridBagConstraints.NORTHEAST; gbc_btnStart.insets = new Insets(0, 0, 5, 5); gbc_btnStart.gridx = 2; gbc_btnStart.gridy = 11; panel.add(btnStart, gbc_btnStart);

GridBagConstraints gbc_btnNext = new GridBagConstraints(); gbc_btnNext.anchor = GridBagConstraints.NORTHWEST; gbc_btnNext.insets = new Insets(0, 0, 5, 5); gbc_btnNext.gridx = 4; gbc_btnNext.gridy = 11; panel.add(btnNext, gbc_btnNext); btnCancel = new JButton("Cancel"); GridBagConstraints gbc_btnCancel = new GridBagConstraints(); gbc_btnCancel.anchor = GridBagConstraints.NORTHWEST; gbc_btnCancel.insets = new Insets(0, 0, 5, 5); gbc_btnCancel.gridx = 6; gbc_btnCancel.gridy = 11; panel.add(btnCancel, gbc_btnCancel); GridBagConstraints gbc_btnSubmit = new GridBagConstraints(); gbc_btnSubmit.anchor = GridBagConstraints.NORTHWEST; gbc_btnSubmit.insets = new Insets(0, 0, 5, 5); gbc_btnSubmit.gridx = 8; gbc_btnSubmit.gridy = 11; panel.add(btnSubmit, gbc_btnSubmit); btnCancel = new JButton("Cancel"); btnCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) {

} }); lblTechnicalKnowledgTest = new JLabel(""); lblTechnicalKnowledgTest.setVerticalAlignment(SwingConstants.TOP);

lblTechnicalKnowledgTest.setIcon(new ImageIcon(Quiz_Test.class.getResource("/Images/red1.jpg"))); lblTechnicalKnowledgTest.setBounds(0, 0, 871, 547); getContentPane().add(lblTechnicalKnowledgTest);

} void clear() { //lqno.setText(""); lqno1.setText(""); lbt.setText(""); tqd.setText(""); opt1.setText(""); opt2.setText(""); opt3.setText(""); opt4.setText(""); } public void BeginaddResult() { String mail=a.user().trim(); try { String (?,?,?,?,?,?,?)"; qry="insert into exam values (MailID,Begin_ST,Begin_TQ,Begin_TA,Begin_CA,Inter_ST,Expert_ST)

String MailID=?";

qry1="update

exam

set where

Begin_ST=?,Begin_TQ=?,Begin_TA=?,Begin_CA=?,Inter_ST=?,Expert_ST=? con=db.getConnection(); st=con.createStatement(); pst=con.prepareStatement(qry); pst1=con.prepareStatement(qry1); rs1=st.executeQuery("Select MailID='"+mail+"'"); if(rs1.next()) { if(ans>=6) { pst1.setString(1,"Completed"); pst1.setInt(2,Beg); pst1.setInt(3,qn-1); pst1.setInt(4,ans); pst1.setString(5,mail); pst1.setString(6,"Not Completed"); pst1.setString(7,"Not Completed"); pst1.executeUpdate(); JOptionPane.showMessageDialog(getParent(), Corerectly Answered :\t"+ans+"\n Status \t\t: Completed", "Exam Completed",1); } else { pst1.setString(1,"Not Completed"); pst1.setInt(2,Beg); pst1.setInt(3,qn-1); pst1.setInt(4,ans); MailID from exam

where

"Your

Exam completed \n Total Questions \t:"+Beg+"\n Answered Questions \t:"+(qn--)+"\n

pst1.setString(5,mail); pst1.setString(6,"Not Completed"); pst1.setString(7,"Not Completed"); pst1.executeUpdate(); JOptionPane.showMessageDialog(getParent(), Corerectly Answered :\t"+ans+"\n Status \t\t: Not Selected","Exam Completed",1); } } else { if(ans>=6) { pst.setString(1,mail); pst.setString(2,"Completed"); pst.setInt(3,Beg); pst.setInt(4,qn-1); pst.setInt(5,ans); pst.setString(6,"Not Completed"); pst.setString(7,"Not Completed"); pst.executeUpdate(); JOptionPane.showMessageDialog(getParent(), "Your Exam completed \n Total Questions \t:"+Beg+"\n Answered Questions \t:"+(qn--) +"\n Corerectly Answered :\t"+ans+"\n Status \t\t: Completed", "Exam Completed",1); } else { pst.setString(1,mail); pst.setString(2,"Not Completed"); pst.setInt(3,Beg); pst.setInt(4,qn-1); "Your Exam completed \n Total Questions \t:"+Beg+"\n Answered Questions \t:"+(qn--)+"\n

pst.setInt(5,ans); pst.setString(6,"Not Completed"); pst.setString(7,"Not Completed"); pst.executeUpdate(); JOptionPane.showMessageDialog(getParent(), "Your Exam completed \n Total Questions \t:"+Beg+"\n Answered Questions \t:"+(qn--) +"\n Corerectly Answered :\t"+ans+"\n Status \t\t: Not Selected","Exam Completed",1); } } } catch (SQLException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } } public void InterResult() { String mail=a.user().trim(); try { String String qry="insert qry1="update into exam exam set (MailID,Inter_ST,Inter_TQ,Inter_TA,Inter_CA) values (?,?,?,?,?)"; Inter_ST=?,Inter_TQ=?,Inter_TA=?,Inter_CA=? where MailID=?"; con=db.getConnection(); st=con.createStatement(); pst=con.prepareStatement(qry); pst1=con.prepareStatement(qry1); rs1=st.executeQuery("Select MailID='"+mail+"'"); if(rs1.next()) MailID from exam where

{ if(ans>=14) { pst1.setString(1,"Completed"); pst1.setInt(2,Inter); pst1.setInt(3,qn-1); pst1.setInt(4,ans); pst1.setString(5,mail); pst1.executeUpdate(); JOptionPane.showMessageDialog(getParent(), Corerectly Answered :\t"+ans+"\n Status \t\t: Completed", "Exam Completed",1); } else { pst1.setString(1,"Not Completed"); pst1.setInt(2,Inter); pst1.setInt(3,qn-1); pst1.setInt(4,ans); pst1.setString(5,mail); pst1.executeUpdate(); JOptionPane.showMessageDialog(getParent(), Corerectly Answered :\t"+ans+"\n Status \t\t: Not Selected","Exam Completed",1); } } else { if(ans>=14) { pst.setString(1,mail); "Your Exam completed \n Total Questions \t:"+Inter+"\n Answered Questions \t:"+(qn--)+"\n "Your Exam completed \n Total Questions \t:"+Inter+"\n Answered Questions \t:"+(qn--)+"\n

pst.setString(2,"Completed"); pst.setInt(3,Inter); pst.setInt(4,qn-1); pst.setInt(5,ans); pst.executeUpdate(); JOptionPane.showMessageDialog(getParent(), "Your Exam completed \n Total Questions \t:"+Inter+"\n Answered Questions \t:"+(qn--) +"\n Corerectly Answered :\t"+ans+"\n Status \t\t: Completed", "Exam Completed",1); } else { pst.setString(1,mail); pst.setString(2,"Not Completed"); pst.setInt(3,Inter); pst.setInt(4,qn-1); pst.setInt(5,ans); pst.executeUpdate(); JOptionPane.showMessageDialog(getParent(), "Your Exam completed \n Total Questions \t:"+Inter+"\n Answered Questions \t:"+(qn--) +"\n Corerectly Answered :\t"+ans+"\n Status \t\t: Not Selected","Exam Completed",1); } } } catch (SQLException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } } public void ExpertResult()

{ String mail=a.user().trim(); try { String String qry="insert qry1="update into exam exam set (MailID,Expert_ST,Expert_TQ,Expert_TA,Expert_CA) values (?,?,?,?,?)"; Expert_ST=?,Expert_TQ=?,Expert_TA=?,Expert_CA=? where MailID=?"; con=db.getConnection(); st=con.createStatement(); pst=con.prepareStatement(qry); pst1=con.prepareStatement(qry1); rs1=st.executeQuery("Select MailID='"+mail+"'"); if(rs1.next()) { if(ans>=25) { pst1.setString(1,"Completed"); pst1.setInt(2,Expert); pst1.setInt(3,qn-1); pst1.setInt(4,ans); pst1.setString(5,mail); pst1.executeUpdate(); JOptionPane.showMessageDialog(getParent(), Corerectly Answered :\t"+ans+"\n Status \t\t: Completed", "Exam Completed",1); } else { pst1.setString(1,"Not Completed"); pst1.setInt(2,Expert); "Your Exam completed \n Total Questions \t:"+Expert+"\n Answered Questions \t:"+(qn--)+"\n MailID from exam where

pst1.setInt(3,qn-1); pst1.setInt(4,ans); pst1.setString(5,mail); pst1.executeUpdate(); JOptionPane.showMessageDialog(getParent(), Corerectly Answered :\t"+ans+"\n Status \t\t: Not Selected","Exam Completed",1); } } else { if(ans>=25) { pst.setString(1,mail); pst.setString(2,"Completed"); pst.setInt(3,Expert); pst.setInt(4,qn-1); pst.setInt(5,ans); pst.executeUpdate(); JOptionPane.showMessageDialog(getParent(), "Your Exam completed \n Total Questions \t:"+Expert+"\n Answered Questions \t:"+ (qn--)+"\n Corerectly Answered } else { pst.setString(1,mail); pst.setString(2,"Not Completed"); pst.setInt(3,Expert); pst.setInt(4,qn-1); pst.setInt(5,ans); :\t"+ans+"\n Status \t\t: Completed", "Exam Completed",1); "Your Exam completed \n Total Questions \t:"+Expert+"\n Answered Questions \t:"+(qn--)+"\n

pst.executeUpdate(); JOptionPane.showMessageDialog(getParent(), "Your Exam completed \n Total Questions \t:"+Expert+"\n Answered Questions \t:"+ (qn--)+"\n Corerectly Answered :\t"+ans+"\n Status \t\t: Not Selected","Exam Completed",1); } } } catch (SQLException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } } }

class Timer1 extends Thread{ private int min,sec; private String Smin,Ssec; Quiz_Test l; public Timer1(final int x,final int y) { min=x; sec=y; } @SuppressWarnings("deprecation") public void run(){ // min=x; //sec=y;

while(true){ try{ sleep(1000); } catch(Exception e){} sec=sec-1; if(sec<1){ min=min-1; sec=60; } if(min<10){ Smin="0" + min; } else{ Smin="" + min; } if(sec<10){ Ssec="0" + sec; } else{ Ssec="" + sec; } Quiz_Test.lbt.setText(Smin + ":" + Ssec); if(min<1 && sec==1){ final JDialog jd=new JDialog(); Label l1=new Label("Your Times Up",Label.CENTER); JButton b1=new JButton("Ok -End Test"); b1.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent a){ String level=Quiz_Test.Sta.getText().trim().toUpperCase();

Quiz_Test.btnNext.setEnabled(false); if(level.equals("BEGINNER")) { l.BeginaddResult(); } else if(level.equals("INTERMEDIATE")) { l.InterResult(); } else if(level.equals("EXPERT")) { l.ExpertResult(); } jd.dispose(); } }); Container con=jd.getContentPane(); con.add(l1,BorderLayout.NORTH); con.add(b1,BorderLayout.SOUTH); jd.setSize(150,100); Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize(); Rectangle winDim = jd.getBounds(); jd.setLocation((screenDim.width - winDim.width) / 2, (screenDim.height - winDim.height) / 2); jd.show(); break; } } }

Timer1(Quiz_Test l){ this.l=l; } }

Screen shot Loading Screen

Login Page

Upload Question

Beginner result Report

Intermediate Result Report

Expert Result Report

Exam Window

Submit result

CONCLUSION

The Quiz Application is a great improvement over the manual system like hand written exams. The computerization of the system has speed up the process and it is time consuming. It is very difficult to keep answer papers and all such things. The system was thoroughly checked and tested with dummy data. The system avoids data redundancy and inconsistency. It provides security and integrity. Data is easily retrieved. Thus the system is user friendly.

FUTURE ENHANCEMENT
The proposed system is purely an Quiz Application we will make this project as online where every customer using their E-mail ID can view their result details; they cant edit or make changes in their account. Also, we can include online, updating by the authorized person. When making online, Exam procedures and latest news about the Exam will be seen in our software. Any comments can be included by the user.

REFERENCE

Books Java 2 Complete Reference.

Core Java 2 Seventh Edition by Cay S. Horstmann and Gary Cornell.

Advanced Java by Balaguruswamy. Programming using Java by David. J. ECK Java Design Patterns by James W. Cooper

You might also like