0% found this document useful (0 votes)
16 views17 pages

Report Javaproject

Uploaded by

meripubgid1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views17 pages

Report Javaproject

Uploaded by

meripubgid1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 17

A

COURSE PROJECT

REPORT ON

ONLINE_JAVA_EXAMINATION

U18IT406

JAVA PROGRAMMING

Submitted to

Department of Information Technology

By

Mr. MOHAMMED ABBU HUZAIFA

B22IT105

Under the supervision of

Dr. T. SENTHIL MURUGAN PhD

ASSOCIATE PROFESSOR & HEAD

DEPARTMENT OF INFORMATION TECHNOLOGY

KAKATIYA INSTITUTE OF TECHNOLOGY AND SCIENCE, WARANGAL -506 015

2023-24
CERTIFICATE

This is to certify that MOHAMMED ABBU HUZAIFA bearing Roll No. B22IT105 of IVth Semester

B.Tech Information Technology has successfully completed the course project entitled

ONLINE_JAVA_EXAMINATION under the course U18IT406 JAVA PROGRAMMING in the

Academic year 2023-24

Course Coordinator Head of the Department


Dr. T. Senthil Murugan Dr. T. Senthil Murugan
Associate Professor Associate Professor
Department of IT Department of IT

1
INDEX

SL. NO CONTENT PAGE No.

1 ABSTRACT 04

2 PROJECT DESCRIPTION 05

3 CODE IN JAVA 06

4 SCREENSHOTS OF OUTPUT 13

5 OUTCOME OF THE PROJECT 15

6 CONCLUSION 16

1
ABSTRACT:

The online Examination portal is a web-based application for technical


evaluation. The online examination portal not only replaces paperwork but
also releases the workload of faculty. Most of the e-examination (Online
Examinations) have fixed number of questions without randomizations, they
have pool scalability. Online examination system is increasing rapidly with the
change in scenario due to the pandemic; also it seems to be an easy, flexible,
and secure methodology to carry the examinations effectively. The general
objective of the online examination system is to minimize the traditional,
manual pen-paper format of examination and introduce the examinees and
examiners to tranquil and effortless mode of examination. In view of a long-
term usage the online examination is here to stay worldwide which enables
the Educational Institutes to evaluate the exams in contented and secure form.
The Web Based Online Examination System is an online test simulator to hold
online examination test in a decisive and skilled manner and thus avoiding
wastage of time for manually examining the test paper.

1
PROJECT DESCRIPTION

The Java Exam Application is a desktop application developed using Java Swing.
It allows students to register by entering their name and roll number before attempting the exam.
The application presents two exam questions, each in its own frame, with the student's name and
roll number displayed for identification.
Question 1 uses radio buttons for single-choice answers, while Question 2 employs checkboxes for
multiple-choice answers.
Navigation buttons such as 'Next' and 'Previous' facilitate easy traversal between questions.
Upon completing both questions, students can submit their exam using the 'Submit' button.
After submission, a dialog box displays the student's exam details, including their name, roll
number, and answers to both questions.
The application features a visually appealing interface with light blue color applied to main panels
and question labels.
GroupLayout is utilized to organize components within each frame, ensuring proper alignment and
spacing.
Action listeners handle user interactions, such as button clicks and answer submissions.
JOptionPane is used for displaying dialog boxes to provide feedback upon exam submission.
Overall, the Java Exam Application provides an intuitive platform for conducting simple exams on
Java programming concepts, suitable for educational purposes in academic environments

1
CODE IN JAVA

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class JavaExam extends JFrame {


private JTextField nameField, rollNoField;
private JLabel nameLabel, rollNoLabel;
private JButton startButton;

public JavaExam() {
setTitle("Java Exam");
setSize(500, 200);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

JPanel mainPanel = new JPanel();


mainPanel.setBackground(new Color(173, 216, 230)); // Light blue color
GroupLayout layout = new GroupLayout(mainPanel);
mainPanel.setLayout(layout);
layout.setAutoCreateGaps(true);
layout.setAutoCreateContainerGaps(true);

nameLabel = new JLabel("Name:");


rollNoLabel = new JLabel("Roll No:");
nameField = new JTextField(5);
rollNoField = new JTextField(5);
startButton = new JButton("Start Exam");

layout.setHorizontalGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(nameLabel)
.addComponent(rollNoLabel))
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)

1
.addComponent(nameField)
.addComponent(rollNoField)
.addComponent(startButton))
);

layout.setVerticalGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(nameLabel)
.addComponent(nameField))
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(rollNoLabel)
.addComponent(rollNoField))
.addComponent(startButton)
);

add(mainPanel);

startButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String name = nameField.getText();
String rollNo = rollNoField.getText();
dispose();
new Question1Frame(name, rollNo);
}
});

setVisible(true);
}

public static void main(String[] args) {


SwingUtilities.invokeLater(new Runnable() {
public void run() {
new JavaExam();
}
});
}
}

1
class Question1Frame extends JFrame {
private JLabel nameLabel, rollNoLabel, questionLabel;
private JRadioButton[] options;
private JButton nextButton;
private String name, rollNo;

private static final String QUESTION = "What is Java's primary purpose?";


private static final String[] OPTIONS = {"A. Web development", "B. Mobile
development", "C. General-purpose programming", "D. Game development"};

public Question1Frame(String name, String rollNo) {


this.name = name;
this.rollNo = rollNo;
setTitle("Java Exam - Question 1");
setSize(400, 200);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

JPanel mainPanel = new JPanel();


mainPanel.setBackground(new Color(173, 216, 230)); // Light blue color
GroupLayout layout = new GroupLayout(mainPanel);
mainPanel.setLayout(layout);
layout.setAutoCreateGaps(true);
layout.setAutoCreateContainerGaps(true);

nameLabel = new JLabel("Name: " + name);


rollNoLabel = new JLabel("Roll No: " + rollNo);
questionLabel = new JLabel("Question: " + QUESTION);
questionLabel.setForeground(Color.BLUE); // Set color of the question label to blue

layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEA
DING)
.addComponent(nameLabel)
.addComponent(rollNoLabel)
.addComponent(questionLabel)
);

layout.setVerticalGroup(layout.createSequentialGroup()
.addComponent(nameLabel)

1
.addComponent(rollNoLabel)
.addComponent(questionLabel)
);

JPanel optionsPanel = new JPanel();


optionsPanel.setBackground(new Color(173, 216, 230)); // Light blue color
optionsPanel.setLayout(new GridLayout(4, 1));

options = new JRadioButton[4];


ButtonGroup optionGroup = new ButtonGroup();
for (int i = 0; i < options.length; i++) {
options[i] = new JRadioButton(OPTIONS[i]);
optionGroup.add(options[i]);
optionsPanel.add(options[i]);
}

JPanel buttonPanel = new JPanel();


buttonPanel.setBackground(new Color(173, 216, 230)); // Light blue color
buttonPanel.setLayout(new FlowLayout());

nextButton = new JButton("Next");


buttonPanel.add(nextButton);

GroupLayout panelLayout = new GroupLayout(getContentPane());


getContentPane().setLayout(panelLayout);
panelLayout.setAutoCreateGaps(true);
panelLayout.setAutoCreateContainerGaps(true);

panelLayout.setHorizontalGroup(panelLayout.createParallelGroup(GroupLayout.Alig
nment.LEADING)
.addComponent(mainPanel)
.addComponent(optionsPanel)
.addComponent(buttonPanel)
);

panelLayout.setVerticalGroup(panelLayout.createSequentialGroup()
.addComponent(mainPanel)
.addComponent(optionsPanel)

1
.addComponent(buttonPanel)
);

nextButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String answer = "";
for (JRadioButton option : options) {
if (option.isSelected()) {
answer = option.getText().substring(0, 1);
break;
}
}
dispose();
new Question2Frame(name, rollNo, answer);
}
});

setVisible(true);
}
}

class Question2Frame extends JFrame {


private JLabel nameLabel, rollNoLabel, questionLabel;
private JCheckBox[] options;
private JButton prevButton, submitButton;
private String name, rollNo, prevAnswer;

private static final String QUESTION = "Which of the following are access modifiers in
Java? (Select multiple)";
private static final String[] OPTIONS = {"A. public", "B. private", "C. protected", "D.
static"};

public Question2Frame(String name, String rollNo, String prevAnswer) {


this.name = name;
this.rollNo = rollNo;
this.prevAnswer = prevAnswer;
setTitle("Java Exam - Question 2");
setSize(400, 200);

1
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

JPanel mainPanel = new JPanel();


mainPanel.setBackground(new Color(173, 216, 230)); // Light blue color
GroupLayout layout = new GroupLayout(mainPanel);
mainPanel.setLayout(layout);
layout.setAutoCreateGaps(true);
layout.setAutoCreateContainerGaps(true);

nameLabel = new JLabel("Name: " + name);


rollNoLabel = new JLabel("Roll No: " + rollNo);
questionLabel = new JLabel("Question: " + QUESTION);
questionLabel.setForeground(Color.BLUE); // Set color of the question label to blue

layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEA
DING)
.addComponent(nameLabel)
.addComponent(rollNoLabel)
.addComponent(questionLabel)
);

layout.setVerticalGroup(layout.createSequentialGroup()
.addComponent(nameLabel)
.addComponent(rollNoLabel)
.addComponent(questionLabel)
);

JPanel optionsPanel = new JPanel();


optionsPanel.setBackground(new Color(173, 216, 230)); // Light blue color
optionsPanel.setLayout(new GridLayout(4, 1));

options = new JCheckBox[4];


for (int i = 0; i < options.length; i++) {
options[i] = new JCheckBox(OPTIONS[i]);
optionsPanel.add(options[i]);
}

JPanel buttonPanel = new JPanel();

1
buttonPanel.setBackground(new Color(173, 216, 230)); // Light blue color
buttonPanel.setLayout(new FlowLayout());

prevButton = new JButton("Previous");


buttonPanel.add(prevButton);

submitButton = new JButton("Submit");


buttonPanel.add(submitButton);

GroupLayout panelLayout = new GroupLayout(getContentPane());


getContentPane().setLayout(panelLayout);
panelLayout.setAutoCreateGaps(true);
panelLayout.setAutoCreateContainerGaps(true);

panelLayout.setHorizontalGroup(panelLayout.createParallelGroup(GroupLayout.Alig
nment.LEADING)
.addComponent(mainPanel)
.addComponent(optionsPanel)
.addComponent(buttonPanel)
);

panelLayout.setVerticalGroup(panelLayout.createSequentialGroup()
.addComponent(mainPanel)
.addComponent(optionsPanel)
.addComponent(buttonPanel)
);

prevButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
new Question1Frame(name, rollNo);
}
});

submitButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
StringBuilder result = new StringBuilder("Exam submitted for: ");
result.append(name).append(" (Roll No: ").append(rollNo).append(")\n\n");

1
result.append("Question 1: ").append(prevAnswer).append("\n");

result.append("Question 2: ");
StringBuilder answers = new StringBuilder();
for (int i = 0; i < options.length; i++) {
if (options[i].isSelected()) {
answers.append(OPTIONS[i].charAt(0)).append(", ");
}
}
if (answers.length() > 0) {
answers.deleteCharAt(answers.length() - 2); // Remove the last comma and
space
}
result.append(answers);

JOptionPane.showMessageDialog(null, result.toString(), "Exam Submission",


JOptionPane.INFORMATION_MESSAGE);
}
});

setVisible(true);
}
}

SCREENSHOTS OF OUTPUT

Fig no :1 – Registration frame

1
Fig no : 2 - Question-1

Fig no:3 – Question 2

1
Fig no: 4 : submission

OUTCOME OF THE PROJECT

1. As a student, after completing this project, I am able to design real time application.

2. I am able to create new application for any society requirements

3. It is helpful for understanding the java programming cours

1
CONCLUSION

The o n l i n e _ j a v a _ e x a m i n a t i o n Application provides a convenient platform for


conducting simple exams on Java programming concepts. With its intuitive interface
and navigational features, it offers an effective way for students to demonstrate their
knowledge and understanding. The application's use of color and layout design
contributes to an engaging user experience, making it suitable for educational
purposes in academic environments.

1
1

You might also like