+ All Categories
Home > Documents > Sandeep Kaur

Sandeep Kaur

Date post: 20-Feb-2016
Category:
Upload: ranjusingla
View: 235 times
Download: 2 times
Share this document with a friend
Description:
hdfc banks
Popular Tags:
70
Multiple Choice Questions Project Report BCA(6 th sem) Submitted To:- Lect.Mrs. Purnima Submitted By:- Sandeep Kaur 1
Transcript
Page 1: Sandeep Kaur

Multiple Choice Questions

Project Report

BCA(6th sem)

Submitted To:-Lect.Mrs. Purnima Submitted By:-

Sandeep Kaur

1

Page 2: Sandeep Kaur

Sh.L.B.S.Arya Mahila College,Barnala

PREFACEThe “Multiple Choice Questions” 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.

Being able to process data and use effectively is vital to both

private and public organizations. Without the improvement and reliability

of system, it would be impossible for a business to exist for very long.

The information system of organization consist of a number of

subsystem involved in the collection where complex decision problem

are solved by computer routines.

2

Page 3: Sandeep Kaur

AACKNOWLEDGEMENTCKNOWLEDGEMENT

It is incredibly gigantic task to quantify the contribution of those who were

directly or indirectly associated with this project because doing so would

be belittling their invaluable support which we got throughout the project.

We express our profound sense of gratitude to Lect. Purnima of the Sh.

L.B.S.Arya Mahila College. for providing various facilities needed for

successful completion of the project and for time to time enunciating

concept related to project.

We own our special thanks to all the faculty members of the centre

who helped us in completion of our project, for proper help and

constructive criticism in developing the project. The overall systematic

approach and encouragement inspire me to overcome the problem in

completion such a stupendous work. Last but not the least I want to thanks

my friends for their willing cooperation during development of project.

Thanks.

……………………

Students Sign:-

3

Page 4: Sandeep Kaur

PROJECT DESCRIPTION

The project “Multiple Choice Questions ” is developed in Java, which

mainly focuses on basic Exam operations. “ Multiple Choice Questions ”

is a windows application written for 32bit Windows operating systems,

designed to help users to give exams.

In our project Multiple Choice Questions we can create an account,

writing exam using that account and we get our result also.In this new user

can “SignUp” and already exists user can “LogIn” and then “SelectExam”

and perform their test.It is easy to understand . this project can be easily

accessed by both technical and non-technical users and can fulfill their

needs.

The “Multiple Choice Questions” is a great

improvement over the manual system like hand written exams.

4

Page 5: Sandeep Kaur

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.

Our proposed system has the following advantages.

User friendly Interface

Fast access to database

Less error

Storage Capacity

5

Page 6: Sandeep Kaur

INTRODUCTION

Java is a general purpose ,object oriented programming language developed by Sun Microsystems of USA in 1991.Originally called Oak by James Gosling .Java was designed for the development of software for consumer electronic devices like TVs , VCRs,and such other electronic machines.

Features of Java-

1. Compiled And Interpreted2. Platform Independent And Portable3. Object Oriented4. Robust And Secure5. Distributed6. Simple , Small And Familiar7. Multithreaded And Interactive8. High Performance

6

Page 7: Sandeep Kaur

INTRODUCTION TO THE AWTAWT stands for Abstract Window ToolKit. The Abstract Window Toolkit provides many classes for programmers to use. It is your connection between your application and the native GUI. The AWT hides you from the underlying details of the GUI your application will be running on and thus is at very high level of abstraction.

It is a Java package and can be used in any Java program by importing java.awt.* via the import keyword.

Structure of the AWT

The structure of the AWT is rather simple. Controls are components that allow a user to interact with your application in various ways:-.

The AWT hierarchyClasses:

Component o Button o Checkbox o Choice o Container Panel Window o Label o List o Scrollbar o Text Compoment TextArea TextField

7

Page 8: Sandeep Kaur

Image MenuComponent o MenuBar o MenuItem CheckboxMenuItem Menu

INTRODUCTION TO SWING

Swing is a set of classes that provide more powerful and flexible component than are possible with the AWT. these components such as buttons ,check boxes and labels, Swing supplies several exciting additions , including scroll panes ,trees and tables.these components such as buttons hae more capabilities in Swing . for example, a button may have both image and a text string associated with it. Also the image can be changed as the state of button changes. Unlike, AWT component , Swing components are not implemented by platform independent.

The Swing component classes are:-

Classes Description

AbstractButton Abstract superclass for Swing button

JApplet The swing version of Applet.

JButton The swing push button classes.

JCheckBox The swing checkbox classes.

8

Page 9: Sandeep Kaur

JComboBox Encapsulate a Combo Box(combination of a drop

down list & text field)

JLabel The swing version of a Label.

JRadioButton The swing version of a RadioButton.

JScrollPane Encapsulate a Scroll Window.

JTextField The swing version of a TextField.

INTRODUCTION OF JDBC

JDBC (Java Database Connectivity) is a standard API for accessing relational databases from a Java program.  This interface makes it easy to access a database because it provides an abstract layer that hides the low-level details, such as managing sockets.  It also provides for interoperability and portability since it allows a single application to access multiple database management systems simultaneously.  For example, a single application can query and manipulate a database in Oracle and a database in DB2.  Communication with a database management system (DBMS) is through method calls.  These calls are passed to the driver, which in turn, translates them into DBMS-specific calls.  The driver basically acts like a set of library routines.  Therefore, to get your program to communicate with a particular DBMS, you need a compatible JDBC driver.  The basic steps to get your program up and running are:

 9

Page 10: Sandeep Kaur

1. Load the driver and register it with the driver manager2. Connect to a database3. Create a statement4. Execute a query and retrieve the results, or make changes to the database5. Disconnect from the database.

The need of JDBC

Java has been called "the vehicle by which developers will be able to bring dynamic application behavior to the Web" . Users can download applets from either local or remote Web servers for execution inside popular Web browsers such as Netscape Navigat or. Applets run disconnected from the server, just like native applications. Java however, has fallen short of its widely ability to connect to outside resources via a build-in API. The first release of the Java Developers Kit (JDK) in early 1995 had no integrated support for accessing databases. The functionality of Java made it easy to build tools for accessing databases, but there was no prescription about how such drivers ought to function. Several vendors produced good tools for database access but here were no general guidelines for how database access tools should be written.

JDBC Architecture

The JDBC Architecture consists of two layers: the JDBC API, which provides the application-to-JDBC Manager connection, and the JDBC Driver API, which supports the JDBC Manager-to-Driver Connection.

10

Page 11: Sandeep Kaur

Two models for database access are supported by the JDBC API. They are the two-tier model and the three-tier model.

The two-tier model

In the two-tier model, a Java applet or application talks directly to the database. This requires a JDBC driver that can communicate with the particular database management system (DBMS) being accessed. SQL statements are delivered to the database, and the results are sent back to the user.

11

Page 12: Sandeep Kaur

This is referred to as a client/server configuration, in which the users machine is the client and the machine housing the database is the server. The database may be located on another machine to which the user is connected via a network.

The three-tier model

In the three-tier model, commands are sent to a middle tier of services, which then send SQL statements to the database. The database processes the SQL statements and sends the results back to the middle tier, which then sends them to the user.

12

Page 13: Sandeep Kaur

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

ABOUT MS-ACCESS

13

Page 14: Sandeep Kaur

Access is a relational database program .Access is used to enter, edit, Access is a relational database program .Access is used to enter, edit,

and analyze lists of data. Relational databases minimize redundant data.and analyze lists of data. Relational databases minimize redundant data.

Advantages of Access are as Follows:Advantages of Access are as Follows:

Duplicate data is minimizedDuplicate data is minimized

Information is more accurateInformation is more accurate

Data entry is faster and easierData entry is faster and easier

Information can be viewed and sorted in multiple ways.Information can be viewed and sorted in multiple ways.

Information is more secureInformation is more secure

Information can be shared among several usersInformation can be shared among several users

Information retrieval is faster and easierInformation retrieval is faster and easier

HOW TO CREATE THE DATABASEThe steps are as follows:

Click on the start button and open the MS-ACCESS.

14

Page 15: Sandeep Kaur

Click on File menu->>New. From New select Blank Access Database . Type the name of the database in File name box (e.g Exam Suite)

and click on the Create button. Then open the Database window and for create the table select the

Create table in Design view which is shown below:

Now create table question , registration , result as shown in fig below:

15

Page 16: Sandeep Kaur

Design view of question table is shown below:

TABLES USEDName: Question

16

Page 17: Sandeep Kaur

Primary key: scode, qno Fieldname Type Size

scode Text 5qno Number 5qdesc Text 25Choice1 Text 30Choice2 Text 30Choice3 Text 30answer Text 30

Datasheet view of question table is shown below:

Design view of registration table is shown below:

17

Page 18: Sandeep Kaur

TABLES USED

Name: RegistrationPrimary key: Email

Fieldname Type SizeEmail Text 5Fname Text 5Lname Text 25Dob Number 10Quali Text 15Ph Number 15password Text 10

Datasheet view of registration table is shown below:

18

Page 19: Sandeep Kaur

Design view of result table is shown below:

TABLES USED

19

Page 20: Sandeep Kaur

Name: Result

Fieldname Type SizeEmail Text 20Exam Text 10Percent Number 5Status Text 10

Datasheet view of result table is shown below:

HOW TO CONNECT WITH DATABASE 20

Page 21: Sandeep Kaur

Domain : Exam Suite

Front-end : Java

Back-end : MS Access 2003

Before you compile the project you have to set the ODBC connection then only it will work properly

Let us see How to set ODBC connection (MS Access)

1. Click Start button +Click Settings

2. Click Control Panel21

Page 22: Sandeep Kaur

2. Select Administrative tools + Click data Sources (ODBC)

22

Page 23: Sandeep Kaur

4. Then you get ‘ODBC Data Source Administrator’ window (shown below) +Click Add Button

5. Create New Data Source (shown below) +select Microsoft Access Driver (*.mdb,*.accdb) + press Finish button

23

Page 24: Sandeep Kaur

6. ODBC Microsoft Access Set up (shown below) + gives Data Source Name +select Database (Press select button) +select your database (shown below) + Press Ok button

7. Before you close the window make sure that your DSN name is correct or not (shown below) +Press Ok button

24

Page 25: Sandeep Kaur

Now you got the DSN name (ExamSuite)This is the way for connecting ODBC, if

you have any doubt please mail us.

SOURCE CODE

LogFom.java

import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.sql.*;class LogFom extends JFrame implements ActionListener{ JLabel lnl,pwl,ch,ch1,nusr; JTextField lnt; JPasswordField pwt; JButton ok,can,btnr; Container c; String ln,psw;Connection conn; PreparedStatement pstmt;

public void setup()25

Page 26: Sandeep Kaur

{c=getContentPane();resize(350,230);Dimension d=size();setLocation(d.width,d.height);setTitle("Multiple Choice Questions");

c.setLayout(null); lnl=new JLabel("LOGIN EMAIL"); lnt=new JTextField(); lnl.setBounds(20,20,80,30); lnt.setBounds(150,20,180,30); pwl=new JLabel("PASSWORD");

pwt=new JPasswordField();

pwl.setBounds(20,70,80,30); pwt.setBounds(150,70,180,30);

ok=new JButton("OK"); ok.setBounds(50,120,100,30);

can=new JButton("CANCEL"); can.setBounds(180,120,100,30);

nusr=new JLabel("For new user please ");nusr.setBounds(140,165,150,30);

btnr=new JButton("Sign up"); btnr.setBounds(255,169,77,20);

c.add(lnl); c.add(lnt);

26

Page 27: Sandeep Kaur

c.add(pwl); c.add(pwt); c.add(ok); c.add(can);

c.add(nusr);c.add(btnr);

ok.addActionListener(this); can.addActionListener(this);

btnr.addActionListener(this);setVisible(true); }

public void actionPerformed(ActionEvent ae){

String s=ae.getActionCommand();if(s.equals("OK")) { try

{ pstmt = conn.prepareStatement("select * from registration"); ln=lnt.getText(); System.out.println("ln1 "+ln); psw=pwt.getText(); System.out.println("psw "+psw); ResultSet rs=pstmt.executeQuery();

int flag=0; while(rs.next()) { String one=rs.getString("email"); String two=rs.getString("password");

if(ln.equals(one) && psw.equals(two)){

27

Page 28: Sandeep Kaur

flag=1; SelectExam ru=new SelectExam(one);

ru.setUp();setVisible(false);dispose();

}}

if(flag==0){

JOptionPane.showMessageDialog (this, "Invalid User name or Password.",

"Exam Suite "JOptionPane.PLAIN_MESSAGE);

lnt.setText("");pwt.setText("");

}}

catch(SQLException e) { System.out.println("sql exception"); } }

if(s.equals("CANCEL")) { System.exit(0); }

if(s.equals("Sign up")) { new SignUp().setUp();

setVisible(false); }

} 28

Page 29: Sandeep Kaur

LogFom(){ try

{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); conn=DriverManager.getConnection("jdbc:odbc:ExamSuite","",""); } catch(ClassNotFoundException e) { System.out.println("class not exception"); } catch(SQLException e) { System.out.println("sql exception"); } this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

} public static void main(String args[]) { LogFom lf=new LogFom(); lf.setup(); } }

OUTPUT:29

Page 30: Sandeep Kaur

SignUp.java

import javax.swing.*;import java.awt.*;import java.awt.event.*;import java.sql.*;public class SignUp extends JFrame implements ActionListener{

JLabel jlb,jlfna,jllna,jldob,jlqu,jlph,jlpw,jlem;JTextField jtfna,jtlna,jtdob,jtqu,jtph,jtem;JPasswordField jtpw;JButton jbsav,jblog;Container c;Connection conn;

PreparedStatement pstmt;

SignUp()30

Page 31: Sandeep Kaur

{ try

{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); conn=DriverManager.getConnection("jdbc:odbc:ExamSuite","",""); } catch(ClassNotFoundException e) { System.out.println("class not exception"); } catch(SQLException e) { System.out.println("sql exception"); }

this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);}public void setUp(){

c=getContentPane();setSize(900,700);setTitle("Multiple Choice Questions ");c.setBackground(Color.white);c.setLayout(null);

jlb=new JLabel(new ImageIcon("Slide1.jpg"));jlb.setBounds(0,0,900,120);

jlfna=new JLabel("First Name");jlfna.setBounds(260,170,120,30);

jtfna=new JTextField();jtfna.setBounds(440,170,120,30);

31

Page 32: Sandeep Kaur

jllna=new JLabel("Last Name");jllna.setBounds(260,230,120,30);

jtlna=new JTextField();jtlna.setBounds(440,230,120,30);

jldob=new JLabel("Date of Birth");jldob.setBounds(260,290,120,30);

jtdob=new JTextField();jtdob.setBounds(440,290,120,30);

jlqu=new JLabel("Qualification");jlqu.setBounds(260,350,120,30);

jtqu=new JTextField();jtqu.setBounds(440,350,120,30);

jlph=new JLabel("Phone No.");jlph.setBounds(260,410,120,30);

jtph=new JTextField();jtph.setBounds(440,410,120,30);

jlem=new JLabel("E mail");jlem.setBounds(260,470,120,30);jtem=new JTextField();

jtem.setBounds(440,470,120,30);

jlpw=new JLabel("Password");jlpw.setBounds(260,530,120,30);

32

Page 33: Sandeep Kaur

jtpw=new JPasswordField();jtpw.setBounds(440,530,120,30);

jbsav=new JButton("Save");jbsav.setBounds(260,590,100,30);

jblog=new JButton("Go to Login");jblog.setBounds(460,590,100,30);

c.add(jlb);c.add(jlfna);c.add(jtfna);c.add(jllna);c.add(jtlna);c.add(jldob);c.add(jtdob);c.add(jlqu);c.add(jtqu);c.add(jlph);c.add(jtph);c.add(jlem);c.add(jtem);c.add(jlpw);c.add(jtpw);c.add(jbsav);c.add(jblog);jbsav.addActionListener(this);jblog.addActionListener(this);

setVisible(true);}public void actionPerformed(ActionEvent ae){

33

Page 34: Sandeep Kaur

String s=ae.getActionCommand(); Object obj=ae.getSource();String email=new String(" ");

if(s.equals("Save")){

try{pstmt=conn.prepareStatement("insert into registration

values(?,?,?,?,?,?,?)");

String fname=jtfna.getText();pstmt.setString(2,fname);String lname=jtlna.getText();pstmt.setString(3,lname);String dob=jtdob.getText();pstmt.setString(4,dob);String qual=jtqu.getText();pstmt.setString(5,qual);String ph=jtph.getText();pstmt.setString(6,ph);email=jtem.getText();pstmt.setString(1,email);String pw=jtpw.getText();pstmt.setString(7,pw);

pstmt.executeUpdate();}catch(SQLException se){

JOptionPane.showMessageDialog (this, "Error in saving the file","Exam Suite - SQL Error", JOptionPane.PLAIN_MESSAGE);

} JOptionPane.showMessageDialog (this, "Successful Registration ",

34

Page 35: Sandeep Kaur

"Exam Suite ", JOptionPane.PLAIN_MESSAGE);jtfna.setText("");jtlna.setText("");jtdob.setText("");jtqu.setText("");jtph.setText("");jtem.setText("");jtpw.setText("");

}if(s.equals("Go to Login")){

new LogFom().setup();setVisible(false);}

}public static void main(String args[])

{SignUp rt=new SignUp();rt.setUp();

}}

OUTPUT:

35

Page 36: Sandeep Kaur

SelectExam.java

import javax.swing.*;import java.awt.*;import java.awt.event.*;import java.sql.*;public class SelectExam extends JFrame implements ActionListener{

JPanel jpl = new JPanel();JLabel lbse,jlqn,jlqd,jlb;JTextField jtex;JComboBox jcbse;JRadioButton jone,jtwo,jthree;

36

Page 37: Sandeep Kaur

ButtonGroup g = new ButtonGroup();JButton jbse,jbse1;Container c; Connection conn;

PreparedStatement pstmt;int qn=0,count=0,ans=0;String com="empty",seven="empty",email,exam;SelectExam(String eml){ try

{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); conn=DriverManager.getConnection("jdbc:odbc:ExamSuite","",""); } catch(ClassNotFoundException e) { System.out.println("class not exception"); } catch(SQLException e) { System.out.println("sql exception"); }

email=eml;this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

}public void setUp(){

c=getContentPane();setSize(900,700);setTitle("Multiple Choice Questions");c.setBackground(Color.white);c.setLayout(null);

37

Page 38: Sandeep Kaur

jlb=new JLabel(new ImageIcon(((new ImageIcon("Slide1.jpg")).getImage()).getScaledInstance(1000, 90, java.awt.Image.SCALE_SMOOTH)));

jlb.setBounds(0,0,900,120);

lbse=new JLabel("Select an Exam:");lbse.setBounds(240,150,140,30);

String se[]={"C","C++","Java"};jcbse=new JComboBox(se);jcbse.setBounds(350,150,120,30);

jtex=new JTextField();jtex.setBounds(350,150,120,30);

jbse=new JButton("Continue");jbse.setBounds(500,150,100,30);

jlqn=new JLabel(" ");jlqn.setBounds(255,235,30,30);

jlqd=new JLabel(" ");jlqd.setBounds(280,235,600,30);

jone = new JRadioButton("",false);jone.setBounds(280,275,600,25);

jone.setBackground(Color.white);jtwo = new JRadioButton("",false);jtwo.setBounds(280,295,600,25);

jtwo.setBackground(Color.white);jthree = new JRadioButton("",false);

38

Page 39: Sandeep Kaur

jthree.setBounds(280,315,600,25); jthree.setBackground(Color.white);

g.add(jone);g.add(jtwo);g.add(jthree);

jbse1=new JButton("Next");jbse1.setBounds(350,600,100,30);

c.add(jlb);c.add(lbse);c.add(jcbse);c.add(jtex);c.add(jbse);c.add(jlqn);c.add(jlqd);

c.add(jbse1);

jbse.addActionListener(this);jbse1.addActionListener(this);jone.addActionListener(this);jtwo.addActionListener(this);jthree.addActionListener(this);

setVisible(true);jbse1.setVisible(false);jtex.setVisible(false);

} public void actionPerformed(ActionEvent ae)

{ String s=ae.getActionCommand();

Object obj=ae.getSource();

if(s.equals("Continue")){

39

Page 40: Sandeep Kaur

try {

pstmt=conn.prepareStatement("select * from question where scode= ?"); exam=""+jcbse.getSelectedItem();

pstmt.setString(1,exam);

ResultSet rs=pstmt.executeQuery(); while(rs.next()) {

jbse1.setVisible(true); jlqd.setText("To start Exam please click the next button");

count++; }

System.out.println(count);}

catch(SQLException e) { System.out.println("sql exception"); }

jbse.setVisible(false);jtex.setVisible(true);jtex.setText(" "+jcbse.getSelectedItem());jtex.setEditable(false);jcbse.setVisible(false);

}if(s.equals("Next")){c.add(jone);c.add(jtwo);c.add(jthree); jone.setSelected(false);jtwo.setSelected(false);

40

Page 41: Sandeep Kaur

jthree.setSelected(false);

if(com.equals("empty") || seven.equals("empty")){}else if(com.equals(seven)){ans++;System.out.println("Continue: "+ans);}qn=qn+1;if(qn<=count){try

{pstmt=conn.prepareStatement("select * from question where scode= ? AND qno=?"); String sc=""+jcbse.getSelectedItem();

pstmt.setString(1,sc);pstmt.setString(2,""+qn);

System.out.println("SC "+sc);

ResultSet rs=pstmt.executeQuery(); while(rs.next()) { String one=rs.getString("scode"); String two=rs.getString("qno");

String three=rs.getString("qdesc"); String four=rs.getString("choice1");

String five=rs.getString("choice2"); String six=rs.getString("choice3");

seven=rs.getString("answer");

41

Page 42: Sandeep Kaur

System.out.println("Answers: "+seven);

jlqn.setText(two);jlqd.setText(three);jone.setText(four);jtwo.setText(five);jthree.setText(six);System.out.println(one);System.out.println(two); System.out.println(three);System.out.println(four);System.out.println(five);System.out.println(six);

}}

catch(SQLException e) { System.out.println("sql exception"); }

}else{

String elig;if(ans>=5)elig="Eligible";elseelig="Not Eligible";try{

pstmt=conn.prepareStatement("insert into result values(?,?,?,?)");pstmt.setString(1,email);pstmt.setString(2,exam);

42

Page 43: Sandeep Kaur

pstmt.setString(3,""+ans+"0");pstmt.setString(4,elig);pstmt.executeUpdate();}catch(SQLException se){

JOptionPane.showMessageDialog (this, "Error in saving the data", "Exam Suite - SQL Error", JOptionPane.PLAIN_MESSAGE);

}

Result r = new Result(email,exam,ans,elig);r.setUp();setVisible(false);dispose();}

}if(obj==jone){com=jone.getText();System.out.println(com);}if(obj==jtwo){com=jtwo.getText();System.out.println(com);}if(obj==jthree){com=jthree.getText();System.out.println(com);}

43

Page 44: Sandeep Kaur

}} OUTPUT:

Result.java

import javax.swing.*;44

Page 45: Sandeep Kaur

import java.awt.*;import java.awt.event.*;import java.sql.*;

public class Result extends JFrame implements ActionListener{

JLabel jlb,jlna,jlex,jlpr,jlst,res;JTextField jtna,jtex,jtpr,jtst;JButton jbexit,jbhm;Container c; Connection conn;

PreparedStatement pstmt;String email,exam,fn,ln,name,per,st,el;int an;

Result(String eml,String ex,int ans, String elig){

email=eml;exam=ex;an=ans;el=elig;

try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

conn=DriverManager.getConnection("jdbc:odbc:ExamSuite","","");

pstmt=conn.prepareStatement("select * from registration where email= ?");pstmt.setString(1,email);

ResultSet rs=pstmt.executeQuery();

while(rs.next())45

Page 46: Sandeep Kaur

{fn=rs.getString("fname");ln=rs.getString("lname");}}

catch(ClassNotFoundException e) { System.out.println("class not exception"); } catch(SQLException e) { System.out.println("sql exception"); } name=fn+" "+ln;

this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);}

public void setUp()

{c=getContentPane();setSize(900,700);setTitle("Multiple Choice Questions");c.setBackground(Color.white);c.setLayout(null);

jlb=new JLabel(new ImageIcon("Slide1.jpg"));jlb.setBounds(0,0,900,120);

res=new JLabel("RESULT");res.setBounds(400,150,120,30);

jlna=new JLabel("Name");46

Page 47: Sandeep Kaur

jlna.setBounds(260,230,120,30);

jtna=new JTextField(name);jtna.setBounds(440,230,120,30);

jlex=new JLabel("Exam");jlex.setBounds(260,290,120,30);

jtex=new JTextField(exam);jtex.setBounds(440,290,120,30);

jlpr=new JLabel("Percentage");jlpr.setBounds(260,350,120,30);

jtpr=new JTextField(an+"0%");jtpr.setBounds(440,350,120,30);

jlst=new JLabel("Status");jlst.setBounds(260,410,120,30);

jtst=new JTextField(el);jtst.setBounds(440,410,120,30);

jbexit=new JButton("Exit");jbexit.setBounds(260,500,100,30);

jbhm=new JButton("Logout");jbhm.setBounds(460,500,100,30);

c.add(res);c.add(jlb);

47

Page 48: Sandeep Kaur

c.add(jlna);c.add(jtna);c.add(jlex);c.add(jtex);c.add(jlpr);c.add(jtpr);c.add(jlst);c.add(jtst);c.add(jbexit);c.add(jbhm);

jbexit.addActionListener(this);jbhm.addActionListener(this);

setVisible(true);

}

public void actionPerformed(ActionEvent ae)

{

String s=ae.getActionCommand();

if(s.equals("Exit"))System.exit(0);

if(s.equals("Logout")){new LogFom().setup();setVisible(false);dispose();}

48

Page 49: Sandeep Kaur

}}

OUTPUT:

FULL WORKING AND IMPLEMENTATION OF PROJECT

Multiple Choice Questions : Login

49

Page 50: Sandeep Kaur

Multiple Choice Questions : SignUp

Multiple Choice Questions : Login

50

Page 51: Sandeep Kaur

Multiple Choice Questions : Select Exam

Multiple Choice Questions : Start Exam51

Page 52: Sandeep Kaur

Multiple Choice Questions : Exam

Multiple Choice Questions : Exam52

Page 53: Sandeep Kaur

Multiple Choice Questions : Exam

Multiple Choice Questions : Result53

Page 54: Sandeep Kaur

54

Page 55: Sandeep Kaur

55


Recommended