Career Information Management System Java Project

by | Jun 22, 2023 | Basic Coding, Coding, Java

Home » Coding » Career Information Management System Java Project

Introduction of the Project

Career Information Management System Java Project creates a management system for an organization that wants to shortlist students who can work in their organization. We will implement some GUI using the Swing Module to make this Java project more enjoyable.

To do this project, firstly, we ask the candidate to enter his details like name, age, and mail ID. After entering these details, the user also gets an option to upload his CV/Resume on the system portal. Once all these details have been submitted, the user will get an MCQ exam on his screen.

Now this management system will calculate the result score of the individual candidate and store it in a table alongside the other details of the candidate. The organization can use this table to shortlist the candidates based on the score, and they will have the details stored in one place.

 

Objectives

The Career Information Management System Java Project has the following objectives that we want to achieve.

1. To use SQL database to store information regarding the person who has taken the test, age, email, Resume & score in the exam.

2. To implement the tables containing the exam-related information and attach the functionality of calculating scores and storing it in the database so that an organization can choose students accordingly.

3. To create a user-friendly user interface.

Requirements

1. Java Compiler IDE

2. Swing Module To Create The Graphical User Interface (GUI)

Source Code

package com.company;
public class Main {
public static void main(String[] args) {
new Career();
}
}
package com.company;
import javax.swing.*;
import java.awt.*
public class Career {
private JButton TAKEEXAMButton;
private JButton STATUSButton;
private JPanel mainPanel;
JFrame examF = new JFrame();
public Career(){
examF.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
examF.setContentPane(mainPanel);
examF.pack();
examF.setLocationRelativeTo(null);
examF.setVisible(true);
TAKEEXAMButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
examF.dispose();
new Candidate();
}
});
STATUSButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
examF.dispose();
new Status();
}
});
}
}
package com.company;
import javax.swing.*;
import java.awt.*
import java.io.File;
import java.io.FileReader;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Candidate {
private JTextField nameData;
private JTextField ageData;
private JButton SUBMITButton;
private JButton BACKButton;
private JPanel studentPanel;
private JTextField emailData;
private JList list1;
private JButton SELECTCVButton;
private JTextField path;
JFrame studentF = new JFrame();
public Candidate(){
studentF.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
studentF.setContentPane(studentPanel);
studentF.pack();
studentF.setLocationRelativeTo(null);
studentF.setVisible(true);
SUBMITButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if(nameData.getText().equals("")|| ageData.getText().equals("")|| emailData.getText().equals("")){
JOptionPane.showMessageDialog(null,"Please Fill All Fields to take test.");
}else{
try {
String sql = "insert into career"+"(Name,Age,Email,CV)"+"values (?,?,?,?)";
Class.forName("com.mysql.cj.jdbc.Driver");
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/intern","root","root");
PreparedStatement statement = connection.prepareStatement(sql);
statement.setString(1,nameData.getText());
statement.setString(2, ageData.getText());
statement.setString(3, emailData.getText());
File file = new File(path.getText());
FileReader reader = new FileReader(file);
statement.setCharacterStream(4,reader,file.length());
statement.executeUpdate();
JOptionPane.showMessageDialog(null,"PRESS OK TO CONTINUE");
studentF.dispose();
new Test(nameData.getText(),ageData.getText());
}catch (Exception ex){
System.out.println(ex.getMessage());
}
}
}
});
BACKButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
studentF.dispose();
new Career();
}
});
SELECTCVButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JFileChooser fileChooser = new JFileChooser();
int res = fileChooser.showOpenDialog(null);
if(res == JFileChooser.APPROVE_OPTION){
path.setText(fileChooser.getSelectedFile().getAbsolutePath());
}else {
JOptionPane.showMessageDialog(null,"PLEASE SELECT FILE");
}
}
});
}
}
package com.company;
import javax.swing.*;
import java.awt.event.*
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class Test {
private JPanel testPanel;
private String name;
private String age;
private JButton SUBMITTESTButton;
private JRadioButton ans1;
private JRadioButton ans4;
private JRadioButton ans2;
private JRadioButton ans3;
private JRadioButton ans5;
private int counter=0;
JFrame testF = new JFrame();
public Test(String name,String age){
this.name = name;
this.age = age;
testF.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
testF.setContentPane(testPanel);
testF.pack();
testF.setLocationRelativeTo(null);
testF.setVisible(true);
SUBMITTESTButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
testF.dispose();
new Career();
}
});
SUBMITTESTButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String sql = "UPDATE career " +
"SET Score = '"+ score()+"'"+
" WHERE Name= '"+name+"' AND Age= '"+age+"'";
try{
Class.forName("com.mysql.cj.jdbc.Driver");
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/intern","root","root");
PreparedStatement statement = connection.prepareStatement(sql);
statement.executeUpdate();
JOptionPane.showMessageDialog(null,"EXAM SUBMITTED SUCCESSFULLY.");
}catch (Exception exception){
JOptionPane.showMessageDialog(null,exception.getMessage());
}
testF.dispose();
new Career();
}
});
}
public String score(){
if(ans1.isSelected()){
counter+=2;
}
if(ans2.isSelected()){
counter+=2;
}
if(ans3.isSelected()){
counter+=2;
}
if(ans4.isSelected()){
counter+=2;
}
if(ans5.isSelected()){
counter+=2;
}
String ans = String.valueOf(counter);
ans+="/10";
return ans ;
}
}
package com.company;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import java.awt.*
import java.sql.*;
import java.util.Vector;
public class Status {
private JPanel statusPanel;
private JButton BACKButton;
private JTable table1;
private JTextArea textArea1;
private JButton SHUFFLEButton;
JFrame statusF = new JFrame();
public Status(){
statusF.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
statusF.setContentPane(statusPanel);
statusF.pack();
statusF.setLocationRelativeTo(null);
statusF.setVisible(true);
tableData();
BACKButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
statusF.dispose();
new Career();
}
});
table1.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
DefaultTableModel dm = (DefaultTableModel)table1.getModel();
int selectedRow = table1.getSelectedRow();
textArea1.setText(dm.getValueAt(selectedRow,3).toString());
}
});
}
public void tableData() {
try{
String a= "Select* from career";
Class.forName("com.mysql.cj.jdbc.Driver");
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/intern","root","root");
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery(a);
table1.setModel(buildTableModel(rs));
}catch (Exception ex1){
JOptionPane.showMessageDialog(null,ex1.getMessage());
}
}
public static DefaultTableModel buildTableModel(ResultSet rs)
throws SQLException {
ResultSetMetaData metaData = rs.getMetaData();
// names of columns
Vector<String> columnNames = new Vector<String>();
int columnCount = metaData.getColumnCount();
for (int column = 1; column <= columnCount; column++) {
columnNames.add(metaData.getColumnName(column));
}
// data of the table
Vector<Vector<Object>> data = new Vector<Vector<Object>>();
while (rs.next()) {
Vector<Object> vector = new Vector<Object>();
for (int columnIndex = 1; columnIndex <= columnCount; columnIndex++) {
vector.add(rs.getObject(columnIndex));
}
data.add(vector);
}
return new DefaultTableModel(data, columnNames);
}
}

Explanation of the Code

We can divide the Career Information Management System Java Project source code into 2 sections.

Let’s see the GUI part first:

1. Our main screen consists of 2 buttons for taking exams & checking status.

2. Status panel has a ‘Jtable’ and a button.

3. The Candidate panel consists of 3 text fields, 3 buttons, and a text area.

4. The Test panel consists of a button and 5 ‘Jlabels’ for questions, each with 4 radio buttons as options for answers.

Moving to retrieving information from the SQL database & updating it according to the user’s input, we will apply the following:

1. First, we connected with the database using the Connection object.

2.  Then we Inject the query that stores table data in ‘ResultSet’.

3.  After that, ‘JfileChooser’ pops up a window to select a .txt file.

4. Then we retrieve data from the file locally by FileReader, then pass it to the database.

5. Next, the score is calculated by increasing the total value by 2 for each correct answer.

6. Lastly, we are updating the score to the respective entry in the table from the provided name and age of the candidate.

7. Finally, we send the data to Jtable.

Output

Main Interface

Career Information Management System Java Project

Figure 1: Main Page

Exam Interfaces

Career Information Management System Java Project

Figure 2: Candidate Details Page

Career Information Management System Java Project

Figure 3: Online Examination Page

Status Interface

Figure 4: Results Page

Conclusion

Hence, we have successfully developed a Career Information Management System Java Project that helps to manage information of the person who took the test, his score, contact details & resume & help to take the test. With the implementation of the Swing module for GUI, this program is a very efficient & easy way to conduct an examination and store the results in a database so that an organization can easily shortlist students based on their resumes and score.

More Java Projects>>>

You May Also Like To Create…