Programming Cc4001
Programming Cc4001
RECRUITMENT SYSTEM
1
Table of Contents
Cover Sheet ...................................................................................................................................................................... 3
Introduction ..................................................................................................................................................................... 4
Method Description..........................................................................................................................................................6
Pseucode:........................................................................................................................................................................... 7
Conclusion....................................................................................................................................................................... 20
2
Cover Sheet :
21048721
Darius-Daniel-Sebastian curticapean
23/04/2023
3
Introduction :
Graphical User Interfaces (GUIs) are an integral part of modern software development. A well-designed GUI
can enhance user experience and make software applications more intuitive and user-friendly. This
coursework gives me an opportunity to put in practice what learned in the last few months to construct a GUI
using Java Swing.
The aim of this coursework is to provide an in-depth understanding of how to create interactive and visually
appealing interfaces using Java Swing. This is an opportunity to explore the various Swing library elements
such as buttons, text fields, menus, and dialogues and learn how to combine them to create a cohesive and
functional user interface.
Through this coursework, I will also delve into topics such as event handling, layout managers, and user
input validation. I will put into practice how to handle users’ actions and events, position and align
components on the screen, and ensure that user inputs are validated and processed correctly.
By the end of this coursework, I hope to get a solid understanding of the principles and best practices of GUI
design using Java Swing. They will be equipped with the skills necessary to create elegant and user-friendly
interfaces for a wide range of software applications for my future projects.
4
5
Method Description:
The getVacancy() method is designed to retrieve user input from a text field that represents the
number of vacancies, and then store that value in the vacancy variable.
The getJobType() method is designed to retrieve user input from a text field that represents the
type of job, and then store that value in the jobType variable.
The getStaffName() method is designed to retrieve user input from a text field that represents the
name of the staff member, and then store that value in the staffName variable.
The getQualification() method designed the user to retrieve user input from a text field that
represents the qualification of the staff member, and then store that value in the Qualification
variable.
The getDesignation() method is designed to retrieve user input from a text field that represents the
designation of a staff member and then store that value in the designation variable.
The getJobType() method is designed to retrieve user input from a text field that represents the
type of job, and then store that value in the jobType variable.
The getAppointedBy() method is designed to retrieve user input from a text field that represents the
person who appointed the staff member, and then store that value in the appointed variable.
The getVacancy() method is designed to retrieve user input from a text field that represents the
number of vacancies, and then store that value in the vacancy variable.
The getJoin() method is designed to retrieve user input from this button and return the value
indicating if the staff member has joined or not.
The getWeekFractionalHours() method is used to retrieve user input from a text field named
weekFractionalText that represents the number of fractional hours worked in a week.
The getWeekFractionalHours() method is designed to retrieve the user input from a text field named
weekFractionalText that is used to input the number of fractional hours worked in a week.
The getWorkingHours() method is likely designed to retrieve user input from a text field that
represents the number of working hours, and then store that value in the workingHours variable.
The getShift() method is likely designed to retrieve user input from a text field that represents the
shift worked by the staff member, and then store that value in the shifts variable.
The fulltimeStaffButton is clicked, an action listener is generated which increments a "click" counter
variable. The code then enables or disables multiple text fields based on the user's input.
The partimeButton in a graphical user interface. When the button is clicked, an action listener is
generated that toggles the visibility of certain text fields and increments a counter.
the salaryButton in a graphical user interface. When the button is clicked, it increments a “click2”
counter and enables/disables certain text fields.
6
The workingshiftButton defines button's functionality, which waits for the user to click it. On clicking,
the code increments "click3", enables certain components, disables others, and retrieves job
information.
The Terminate button code creates an ActionListener for the GUI element terminate button, which
handles the termination of an employee's employment. The code increments the "click4" counter
and enables/disables certain text fields based on user input.
The getDisplay() method is likely used in a program with a graphical user interface (GUI) and is
designed to retrieve the user input from a text field that represents a display number and store that
value in a variable called displayNumber.
The Display Button code is designed to display the details of a particular job opening or employee
appointment when the user enters a corresponding index number and clicks the Display Button in
the GUI.
Pseucode:
// This code block increments the click counter for the full-time staff hire button by 1 and resets the other
counters
INCREMENT click BY 1
SET click1 to 0
SET click2 to 0
SET click3 to 0
SET click4 to 0
// This code block enables the relevant input fields for full-time staff hire and disables the irrelevant input
fields
ENABLE vacancyText
ENABLE jobTypeText
ENABLE staffNameText
ENABLE qualificationText
ENABLE designationText
ENABLE jobDateText
ENABLE AppointedText
ENABLE salaryText
ENABLE Joined
ENABLE weekFractionalText
DISABLE WorkingHoursText
DISABLE wegesText
DISABLE shiftsText
7
// This code block enables the buttons for full-time staff hire and disables the buttons for part-time staff hire
and termination
ENABLE salaryButton
ENABLE workingShiftsButton
ENABLE terminateButton
// This code block checks if the click counter for full-time staff hire reaches the threshold of 2 and calls the
fulltime() function if it does
IF click is greater than or EQUAL to 2, then CALL fulltime() function
click2++;
click = 0;
click3 = 0;
click1 = 0;
click4 = 0;
vacancyText.setEnabled(true);
staffNameText.setEnabled(true);
salaryText.setEnabled(true);
9
}
});
10
boolean found = false;
displayAreaTex.setText("");
// Iterate through staffHires and find the PartTimeStaffHire object with
// the given vacancy number and staff name
//The following code searches for a FullTimeStaffHire object with the matching vacancy number in the staff-
Hires list.
for (StaffHire staffHire : staffHires) {
if (staffHire instanceof FullTimeStaffHire && staffHire.getVacancyNumber() == number)
{ FullTimeStaffHire fullTimeStaffHire = (FullTimeStaffHire) staffHire;
11
//The following code removes the FullTimeStaffHire object from the staffHires list.
staffHires.remove(fullTimeStaffHire);
}
}
//The following code checks whether the staffHires list is empty or not, and updates the displayAreaText ac-
cordingly.
if (staffHires.isEmpty())
{ displayAreaText.setText("No staff hired yet.");
} else {
displayAreaText.setText("");
for (StaffHire staffHire : staffHires) {
displayAreaText.append(staffHire.display());
}
}
}
});
displayNumberButton.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
// Check if the display value is within the range of staffHires list
if(getDisplay() <= (staffHires.size() - 1))
{
// Loop through the staffHires list and find the staff hire at the given display value
for (int i = 0; i <= staffHires.size() - 1; i++)
{
// Check if the staff hire at the given index is a FullTimeStaffHire object
if (staffHires.get(getDisplay()) instanceof FullTimeStaffHire fullTimeStaffHire)
{
// Clear the display area text and append the staff details of the FullTimeStaffHire object
displayAreaTex.setText("");
displayAreaTex.append(fullTimeStaffHire.staffDetails());
break;
}
// Check if the staff hire at the given index is a PartTimeStaffHire object
else if (staffHires.get(getDisplay()) instanceof PartTimeStaffHire partTimeStaffHire)
{
// Clear the display area text and append the staff details of the PartTimeStaffHire
object displayAreaTex.setText("");
displayAreaTex.append(partTimeStaffHire.partTimeDetails());
12
break;
}
}
}
// If the display value is out of range, show an error message
else
{
}
});
13
14
15
Conclusion:
In conclusion of the challenging Java coursework, it is evident that the level of complexity in the project was beyond
what was expected. Despite the difficulty in grasping the entire concept, the project presented a great learning
opportunity for me as a future computer network engineer.
The amount of time spent on the coursework besides other commitments was extensive, but the effort put into it
allowed me to explore new skills in coding.
The coursework proved to be a valuable experience, allowing me to broaden my understanding of Java programming,
and enhance my problem-solving skills.
While the challenge was daunting, it provided an excellent opportunity for personal growth and development. Overall,
despite the difficulties encountered, the coursework provided an invaluable learning experience which makes me feel
more confident in my programming abilities as the conclusion of another coursework result.
16