├── FullTimeStaffHire.java ├── INGNepal.java ├── PartTimeStaffHire.java ├── README.md └── StaffHire.java /FullTimeStaffHire.java: -------------------------------------------------------------------------------- 1 | public class FullTimeStaffHire extends StaffHire{ 2 | private int salary; 3 | private int workingHour; 4 | private String staffName; 5 | private String joiningDate; 6 | private String qualification; 7 | private String appointedBy; 8 | private boolean joined; 9 | FullTimeStaffHire(int vacancyNumber, String designation, String jobType, int salary, int workingHour){ 10 | super(vacancyNumber,designation,jobType); 11 | this.salary=salary; 12 | this.workingHour=workingHour; 13 | staffName=""; 14 | joiningDate=""; 15 | qualification=""; 16 | appointedBy=""; 17 | joined=false; 18 | } 19 | //A constructor is called to create objects. 20 | public int getSalary(){ 21 | return salary; 22 | } 23 | //getter method used to get the instance of salary. 24 | public void setSalary(int salary){ 25 | if(joined==false){ 26 | this.salary=salary; 27 | } 28 | else{ 29 | System.out.print("you are already hired so your salary cann't change");; 30 | } 31 | } 32 | //setter method used to set the instance of salary. 33 | public int getWorkingHour(){ 34 | return workingHour; 35 | } 36 | //getter method used to get the instance of workingHour. 37 | public void setWorkinghour(int workinghour){ 38 | this.workingHour=workingHour; 39 | } 40 | //setter method used to set the instance of workinghour. 41 | public String getStaffName(){ 42 | return staffName; 43 | } 44 | //getter method used to get the instance of staffName. 45 | public void setStaffName(String staffName){ 46 | this.staffName=staffName; 47 | } 48 | //setter method used to set the instance of staffName. 49 | public String getJoiningDate(){ 50 | return joiningDate; 51 | } 52 | //getter method used to get the instance of JoiningDate. 53 | public void setJoiningDate(String joiningDate){ 54 | this.joiningDate=joiningDate; 55 | } 56 | //setter method used to set the instance of joiningDate. 57 | public String setQualification(){ 58 | return qualification; 59 | } 60 | //setter method used to set the instance of qualification. 61 | public void getQualification(String qualification){ 62 | this.qualification=qualification; 63 | } 64 | //getter method used to get the instance of qualification. 65 | public String getAppointedBy(){ 66 | return appointedBy; 67 | } 68 | //getter method used to get the instance of AppointedBy. 69 | public void setAppointedBy(String appointedBy){ 70 | this.appointedBy=appointedBy; 71 | } 72 | //setter method used to set the instance of AppointedBy. 73 | public boolean getJoined(){ 74 | return joined; 75 | } 76 | //getter method used to get the instance of Joined. 77 | public void setJoined(boolean joined){ 78 | this.joined=joined; 79 | } 80 | //setter method used to set the instance of Joined. 81 | public void fullTimeStaff(String staffName, String joiningDate, String qualification,String appointedBy){ 82 | this.staffName=staffName; 83 | this.joiningDate=joiningDate; 84 | this.qualification=qualification; 85 | this.appointedBy=appointedBy; 86 | if(joined == true){ 87 | System.out.print("from the "+ joiningDate + staffName +" is with our organization"); 88 | } 89 | else{ 90 | this.staffName=staffName; 91 | this.joiningDate=joiningDate; 92 | this.qualification=qualification; 93 | this.appointedBy=appointedBy; 94 | joined=true; 95 | } 96 | } 97 | // 98 | public void display(){ 99 | super.display(); 100 | if (joined=true){ 101 | System.out.print("staffName= " + staffName + "\n"); 102 | System.out.print("salary= "+salary + "\n"); 103 | System.out.print("workingHour= "+workingHour + "hours" + "\n"); 104 | System.out.print("joiningDate= "+joiningDate + "\n"); 105 | System.out.print("qualification= "+qualification + "\n"); 106 | System.out.print("appointedBy= "+appointedBy + "\n"); 107 | } 108 | } 109 | //Display method which displays the values to be printed. 110 | } 111 | -------------------------------------------------------------------------------- /INGNepal.java: -------------------------------------------------------------------------------- 1 | // importing all the necessary libraries of java 2 | import javax.swing.JFrame; 3 | import javax.swing.JButton; 4 | import javax.swing.JTextField; 5 | import java.awt.FlowLayout; 6 | import javax.swing.JLabel; 7 | import java.awt.event.ActionEvent; 8 | import java.awt.event.ActionListener; 9 | import javax.swing.JPanel; 10 | import javax.swing.JOptionPane; 11 | import java.util.ArrayList; 12 | import java.awt.Color; 13 | //Creating a class named INGNepal. 14 | public class INGNepal{ 15 | JFrame frame; 16 | JPanel panel; 17 | JButton clearbtnft,displaybtnft,previousbtnft,addvacancynumberft,appointvacancyft,FullTimeStaff,PartTimeStaff ; 18 | 19 | private JPanel panel1; 20 | private JLabel vacancynumlblft; 21 | private JLabel designationlblft; 22 | private JLabel jobtypelblft; 23 | private JLabel staffnamelblft; 24 | private JLabel qualificationlblft; 25 | private JLabel joiningdatelblft; 26 | private JLabel appointedbylblft; 27 | private JLabel workinghourlblft; 28 | private JLabel salarylblft; 29 | private JLabel appointvacancynumberft; 30 | private JTextField appointvacancytxtfldft; 31 | private JTextField vacancynumbertxtfldft; 32 | private JTextField designationtxtfldft; 33 | private JTextField jobtypetxtfldft; 34 | private JTextField staffnametxtfldft; 35 | private JTextField qualificationtxtfldft; 36 | private JTextField joiningdatetxtfldft; 37 | private JTextField appointedbytxtfldft; 38 | private JTextField workinghourtxtfldft; 39 | private JTextField salarytxtfldft; 40 | 41 | private JPanel panel2; 42 | private JLabel vacancynumlblpt; 43 | private JLabel designationlblpt; 44 | private JLabel jobtypelblpt; 45 | private JLabel staffnamelblpt; 46 | private JLabel qualificationlblpt; 47 | private JLabel joiningdatelblpt; 48 | private JLabel appointedbylblpt; 49 | private JLabel workinghourlblpt; 50 | private JLabel shiftslblpt; 51 | private JLabel wagesperhourlblpt; 52 | private JLabel appointvacancylblpt; 53 | private JLabel terminatevacancylblpt; 54 | private JTextField appointvacancytxtfldpt; 55 | private JTextField terminatevacancytxtfldpt; 56 | private JTextField vacancynumbertxtfldpt ; 57 | private JTextField designationtxtfldpt; 58 | private JTextField jobtypetxtfldpt; 59 | private JTextField staffnametxtfldpt; 60 | private JTextField qualificationtxtfldpt; 61 | private JTextField joiningdatetxtfldpt; 62 | private JTextField appointedbytxtfldpt; 63 | private JTextField workinghourtxtfldpt; 64 | private JTextField shiftstxtfldpt; 65 | private JTextField wagesperhourtxtfldpt; 66 | JButton previousbtnpt,displaybtnpt,clearbtnpt,terminatebuttonpt,appointbuttonpt,addvacancynumberpt; 67 | //declaring the global variables. 68 | 69 | ArrayListlist = new ArrayList<>(); 70 | //Creating an ArrayList of StaffHire. And the name of the arraylist is list. 71 | public INGNepal(){ 72 | frame = new JFrame("INGNepal"); 73 | frame.setSize(500,700); 74 | frame.setResizable(false); 75 | frame.setLayout(null); 76 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 77 | 78 | panel = new JPanel(); 79 | panel.setBounds(0,0,500,700); 80 | panel.setLayout(null); 81 | panel.setVisible(true); 82 | panel.setBackground(Color.white); 83 | frame.add(panel); 84 | 85 | JLabel GUI = new JLabel("WELCOME TO MY GUI"); 86 | GUI.setBounds(180,290,180,30); 87 | panel.add(GUI); 88 | GUI.setForeground(Color.red); 89 | 90 | JLabel dash = new JLabel("_____________________"); 91 | dash.setBounds(180,292,180,30); 92 | panel.add(dash); 93 | dash.setForeground(Color.blue); 94 | 95 | PartTimeStaff = new JButton("PART TIME STAFF"); 96 | PartTimeStaff.setBounds(80,350,140,30); 97 | panel.add(PartTimeStaff); 98 | 99 | PartTimeStaff.addActionListener(new ActionListener(){ 100 | public void actionPerformed(ActionEvent ae){ 101 | panel.setVisible(false); 102 | PartTimeMethod(); 103 | panel2.setVisible(true); 104 | } 105 | }); 106 | 107 | FullTimeStaff = new JButton("FULL TIME STAFF"); 108 | panel.add(FullTimeStaff); 109 | FullTimeStaff.setBounds(260,350,140,30); 110 | 111 | FullTimeStaff.addActionListener(new ActionListener(){ 112 | public void actionPerformed(ActionEvent ac){ 113 | panel.setVisible(false); 114 | FullTimeMethod(); 115 | panel1.setVisible(true); 116 | } 117 | }); 118 | 119 | } 120 | //creating constructor of the class INGNepal and making a frame which contains the panel, JButton, JLabel and JTextField. 121 | public void FullTimeMethod(){ 122 | 123 | panel1=new JPanel(); 124 | panel1.setBounds(0,0,500,700); 125 | panel1.setVisible(false); 126 | panel1.setLayout(null); 127 | frame.add(panel1); 128 | 129 | JLabel label1 = new JLabel("ADDING VACANCY"); 130 | panel1.add(label1); 131 | label1.setBounds(15,30,140,20); 132 | label1.setForeground(Color.red); 133 | 134 | JLabel label2 = new JLabel("FULL TIME"); 135 | panel1.add(label2); 136 | label2.setBounds(180,0,140,40); 137 | label2.setForeground(Color.red); 138 | 139 | JLabel dash1 = new JLabel("______________________________________________________________________"); 140 | panel1.add(dash1); 141 | dash1.setBounds(15,30,500,30); 142 | dash1.setForeground(Color.red); 143 | 144 | JLabel label3 = new JLabel ("APPOINTING VACANCY"); 145 | panel1.add(label3); 146 | label3.setBounds(15,295,300,20); 147 | label3.setForeground(Color.red); 148 | 149 | JLabel dash2 = new JLabel("______________________________________________________________________"); 150 | panel1.add(dash2); 151 | dash2.setBounds(15,295,500,30); 152 | dash2.setForeground(Color.red); 153 | 154 | JLabel label4 = new JLabel("BUTTONS"); 155 | panel1.add(label4); 156 | label4.setBounds(15,505,140,20); 157 | label4.setForeground(Color.blue); 158 | 159 | JLabel dash3 = new JLabel("______________________________________________________________________"); 160 | panel1.add(dash3); 161 | dash3.setBounds(15,505,500,30); 162 | dash3.setForeground(Color.blue); 163 | 164 | vacancynumlblft = new JLabel("VACANCY NUMBER"); 165 | vacancynumlblft.setBounds(15,60,140,20); 166 | panel1.add(vacancynumlblft); 167 | 168 | designationlblft =new JLabel("DESIGNATION"); 169 | designationlblft.setBounds(220,60,140,20); 170 | panel1.add(designationlblft); 171 | 172 | jobtypelblft = new JLabel("JOBTYPE"); 173 | jobtypelblft.setBounds(220,120,140,20); 174 | panel1.add(jobtypelblft); 175 | 176 | staffnamelblft = new JLabel("STAFFNAME"); 177 | staffnamelblft.setBounds(15,330,130,20); 178 | panel1.add(staffnamelblft); 179 | 180 | qualificationlblft = new JLabel("QUALIFICATION"); 181 | qualificationlblft.setBounds(15,390,130,20); 182 | panel1.add(qualificationlblft); 183 | 184 | joiningdatelblft = new JLabel("JOINING DATE"); 185 | joiningdatelblft.setBounds(220,330,130,20); 186 | panel1.add(joiningdatelblft); 187 | 188 | appointedbylblft = new JLabel("APPOINTED BY"); 189 | appointedbylblft.setBounds(220,390,130,20); 190 | panel1.add(appointedbylblft); 191 | 192 | workinghourlblft = new JLabel("WORKING HOUR"); 193 | workinghourlblft.setBounds(15,120,140,20); 194 | panel1.add(workinghourlblft); 195 | 196 | salarylblft = new JLabel("SALARY"); 197 | salarylblft.setBounds(15,180,140,20); 198 | panel1.add(salarylblft); 199 | 200 | appointvacancynumberft = new JLabel("APPOINTED VACANCY"); 201 | appointvacancynumberft.setBounds(15,450,150,20); 202 | panel1.add(appointvacancynumberft); 203 | 204 | appointvacancytxtfldft = new JTextField(); 205 | appointvacancytxtfldft.setBounds(15,475,130,20); 206 | panel1.add(appointvacancytxtfldft); 207 | 208 | appointvacancyft = new JButton("Appoint Vacancy"); 209 | appointvacancyft.setBounds(175,540,130,20); 210 | panel1.add(appointvacancyft); 211 | appointvacancyft.addActionListener(new ActionListener() 212 | { 213 | public void actionPerformed(ActionEvent at){ 214 | fullTimeAppointMethod(); 215 | } 216 | }); 217 | 218 | vacancynumbertxtfldft = new JTextField(); 219 | vacancynumbertxtfldft.setBounds(15,85,140,20); 220 | panel1.add(vacancynumbertxtfldft); 221 | 222 | designationtxtfldft = new JTextField(); 223 | designationtxtfldft.setBounds(220,85,140,20); 224 | panel1.add(designationtxtfldft); 225 | 226 | jobtypetxtfldft = new JTextField(); 227 | jobtypetxtfldft.setBounds(220,145,140,20); 228 | panel1.add(jobtypetxtfldft); 229 | 230 | staffnametxtfldft = new JTextField(); 231 | staffnametxtfldft.setBounds(15,355,130,20); 232 | panel1.add(staffnametxtfldft); 233 | 234 | qualificationtxtfldft = new JTextField(); 235 | qualificationtxtfldft.setBounds(15,415,130,20); 236 | panel1.add(qualificationtxtfldft); 237 | 238 | joiningdatetxtfldft = new JTextField(); 239 | joiningdatetxtfldft.setBounds(220,355,130,20); 240 | panel1.add(joiningdatetxtfldft); 241 | 242 | appointedbytxtfldft = new JTextField(); 243 | appointedbytxtfldft.setBounds(220,415,130,20); 244 | panel1.add(appointedbytxtfldft); 245 | 246 | workinghourtxtfldft = new JTextField(); 247 | workinghourtxtfldft.setBounds(15,145,140,20); 248 | panel1.add(workinghourtxtfldft); 249 | 250 | salarytxtfldft = new JTextField(); 251 | salarytxtfldft.setBounds(15,205,140,20); 252 | panel1.add(salarytxtfldft); 253 | 254 | clearbtnft = new JButton("CLEAR"); 255 | clearbtnft.setBounds(290,600,100,40); 256 | panel1.add(clearbtnft); 257 | clearbtnft.addActionListener(new ActionListener() 258 | { 259 | public void actionPerformed(ActionEvent ae){ 260 | fullTimeClearMethod(); 261 | } 262 | }); 263 | displaybtnft = new JButton("DISPLAY"); 264 | displaybtnft.setBounds(90,600,100,40); 265 | panel1.add(displaybtnft); 266 | displaybtnft.addActionListener(new ActionListener() 267 | { 268 | public void actionPerformed(ActionEvent ah){ 269 | fullTimeDisplayMethod(); 270 | } 271 | }); 272 | 273 | previousbtnft = new JButton("BACK"); 274 | previousbtnft.setBounds(190,600,100,40); 275 | panel1.add(previousbtnft); 276 | previousbtnft.addActionListener(new ActionListener() 277 | { 278 | public void actionPerformed(ActionEvent au){ 279 | fullTimeBackMethod(); 280 | } 281 | }); 282 | 283 | addvacancynumberft = new JButton("Add Vacancy"); 284 | addvacancynumberft.setBounds(15,540,130,20); 285 | panel1.add(addvacancynumberft); 286 | addvacancynumberft.addActionListener(new ActionListener() 287 | { 288 | public void actionPerformed(ActionEvent aa){ 289 | fullTimeAddVacancyMethod(); 290 | } 291 | }); 292 | 293 | } 294 | //Creating a fullTimeMethod. This method contains all the neccary JLabel,JTextField, JButton along with decentralized method for actionListener method for full time panel. 295 | 296 | public void fullTimeAddVacancyMethod(){ 297 | int vn,wh,sy; 298 | String vacancynumber = vacancynumbertxtfldft.getText(); 299 | String designation = designationtxtfldft.getText(); 300 | String jobtype = jobtypetxtfldft.getText(); 301 | String workinghourft = workinghourtxtfldft.getText(); 302 | String salary = salarytxtfldft.getText(); 303 | 304 | if(vacancynumber.trim().equals("")||designation.trim().equals("")||jobtype.trim().equals("")||workinghourft.trim().equals("")||salary.trim().equals("")) 305 | { JOptionPane.showMessageDialog(frame,"Please fill the field","Error",0); 306 | } 307 | else{ 308 | try{ 309 | vn = Integer.parseInt(vacancynumber); 310 | wh = Integer.parseInt(workinghourft); 311 | sy = Integer.parseInt(salary); 312 | if(list.size()==0){ 313 | FullTimeStaffHire fu = new FullTimeStaffHire(vn,designation,jobtype,sy,wh); 314 | list.add(fu); 315 | JOptionPane.showMessageDialog(frame,"successfully added staff","Result",JOptionPane.INFORMATION_MESSAGE); 316 | }else{ 317 | for(StaffHire s : list){ 318 | if(s instanceof FullTimeStaffHire){ 319 | FullTimeStaffHire ft = (FullTimeStaffHire)s; 320 | if(ft.getVacancyNumber()==vn){ 321 | JOptionPane.showMessageDialog(frame,"vacancy already exists","Error",JOptionPane.ERROR_MESSAGE); 322 | 323 | }else{ 324 | FullTimeStaffHire fu = new FullTimeStaffHire(vn,designation,jobtype,sy,wh); 325 | list.add(fu); 326 | JOptionPane.showMessageDialog(frame,"successfully added staff","Result",JOptionPane.INFORMATION_MESSAGE); 327 | 328 | } 329 | } 330 | } 331 | } 332 | } 333 | catch(NumberFormatException nfe){ 334 | JOptionPane.showMessageDialog(frame,"Please enter in correct format","ERROR",0); 335 | return; 336 | } 337 | } 338 | } 339 | //Creating a method that adds the vacancy for FullTimeStaffHire. 340 | public void fullTimeAppointMethod(){ 341 | int vacnom; 342 | String vacnumber = appointvacancytxtfldft.getText(); 343 | String stfname = staffnametxtfldft.getText(); 344 | String qual = qualificationtxtfldft.getText(); 345 | String joindt = joiningdatetxtfldft.getText(); 346 | String appby = appointedbytxtfldft.getText(); 347 | if(vacnumber.trim().equals("")||stfname.trim().equals("")||qual.trim().equals("")||joindt.trim().equals("")||appby.trim().equals("")) 348 | { 349 | JOptionPane.showMessageDialog(frame,"Please fill in all the required boxes","Error",JOptionPane.ERROR_MESSAGE); 350 | }else{ 351 | try{ 352 | vacnom = Integer.parseInt(vacnumber); 353 | boolean condition=false; 354 | for (int i = 0;i < list.size();i++){ 355 | StaffHire sh = list.get(i); 356 | if(sh instanceof FullTimeStaffHire){ 357 | FullTimeStaffHire fth = (FullTimeStaffHire)sh; 358 | if(fth.getVacancyNumber() == vacnom) 359 | { 360 | fth.fullTimeStaff(stfname,joindt,qual,appby); 361 | JOptionPane.showMessageDialog(frame,"Staff appointed successfully","Result",JOptionPane.INFORMATION_MESSAGE); 362 | condition=true; 363 | break; 364 | } 365 | } 366 | } 367 | if(!condition){ 368 | JOptionPane.showMessageDialog(frame,"Vacancy number not found","Error",JOptionPane.ERROR_MESSAGE); 369 | return; 370 | } 371 | }catch(NumberFormatException nfe){ 372 | JOptionPane.showMessageDialog(frame,"Please fill correct values","Error",JOptionPane.ERROR_MESSAGE); 373 | } 374 | } 375 | } 376 | //Creating a method that appoints the vacancy for FullTimeStaffHire. 377 | public void fullTimeDisplayMethod(){ 378 | for (StaffHire s :list) 379 | { 380 | if (s instanceof FullTimeStaffHire){ 381 | FullTimeStaffHire fu = ( FullTimeStaffHire)s; 382 | fu.display(); 383 | } 384 | } 385 | } 386 | //Creating a method that displays the arguements of FullTimeStaffHire in the terminal. 387 | public void fullTimeClearMethod(){ 388 | vacancynumbertxtfldft.setText(""); 389 | designationtxtfldft.setText(""); 390 | jobtypetxtfldft.setText(""); 391 | staffnametxtfldft.setText(""); 392 | qualificationtxtfldft.setText(""); 393 | joiningdatetxtfldft.setText(""); 394 | appointedbytxtfldft.setText(""); 395 | workinghourtxtfldft.setText(""); 396 | salarytxtfldft.setText(""); 397 | appointvacancytxtfldft.setText(""); 398 | JOptionPane.showMessageDialog(frame,"textfields have been cleared","Result",JOptionPane.INFORMATION_MESSAGE); 399 | } 400 | //Creating a method that clears all the arguements in the JTextFields of the FULL TIME panel. 401 | public void fullTimeBackMethod(){ 402 | panel1.setVisible(false); 403 | panel.setVisible(true); 404 | } 405 | //Creating a method that closes the panel of FULL TIME. 406 | public void PartTimeMethod(){ 407 | panel2=new JPanel(); 408 | panel2.setBounds(0,0,500,900); 409 | panel2.setVisible(false); 410 | panel2.setLayout(null); 411 | frame.add(panel2); 412 | 413 | JLabel label5 = new JLabel("ADDING VACANCY"); 414 | panel2.add(label5); 415 | label5.setBounds(15,30,140,20); 416 | label5.setForeground(Color.red); 417 | 418 | JLabel label6 = new JLabel("PART TIME"); 419 | panel2.add(label6); 420 | label6.setBounds(180,0,140,40); 421 | label6.setForeground(Color.red); 422 | 423 | JLabel dash4 = new JLabel("______________________________________________________________________"); 424 | panel2.add(dash4); 425 | dash4.setBounds(15,30,500,30); 426 | dash4.setForeground(Color.red); 427 | 428 | JLabel label7 = new JLabel ("APPOINTING VACANCY & TERMINATING"); 429 | panel2.add(label7); 430 | label7.setBounds(15,295,300,20); 431 | label7.setForeground(Color.red); 432 | 433 | JLabel dash5 = new JLabel("______________________________________________________________________"); 434 | panel2.add(dash5); 435 | dash5.setBounds(15,295,500,30); 436 | dash5.setForeground(Color.red); 437 | 438 | JLabel label8 = new JLabel("BUTTONS"); 439 | panel2.add(label8); 440 | label8.setBounds(15,505,140,20); 441 | label8.setForeground(Color.blue); 442 | 443 | JLabel dash6 = new JLabel("______________________________________________________________________"); 444 | panel2.add(dash6); 445 | dash6.setBounds(15,505,500,30); 446 | dash6.setForeground(Color.blue); 447 | 448 | vacancynumlblpt = new JLabel("VACANCY NUMBER"); 449 | vacancynumlblpt.setBounds(15,60,140,20); 450 | panel2.add(vacancynumlblpt); 451 | 452 | designationlblpt =new JLabel("DESIGNATION"); 453 | designationlblpt.setBounds(220,60,140,20); 454 | panel2.add(designationlblpt); 455 | 456 | jobtypelblpt = new JLabel("JOB TYPE"); 457 | jobtypelblpt.setBounds(220,120,140,20); 458 | panel2.add(jobtypelblpt); 459 | 460 | staffnamelblpt = new JLabel("Staff Name"); 461 | staffnamelblpt.setBounds(15,330,130,20); 462 | panel2.add(staffnamelblpt); 463 | 464 | qualificationlblpt = new JLabel("Qualification:"); 465 | qualificationlblpt.setBounds(15,390,130,20); 466 | panel2.add(qualificationlblpt); 467 | 468 | joiningdatelblpt = new JLabel("Joining Date"); 469 | joiningdatelblpt.setBounds(220,330,130,20); 470 | panel2.add(joiningdatelblpt); 471 | 472 | appointedbylblpt = new JLabel("Appointed By"); 473 | appointedbylblpt.setBounds(220,390,130,20); 474 | panel2.add(appointedbylblpt); 475 | 476 | workinghourlblpt = new JLabel("WORKING HOUR"); 477 | workinghourlblpt.setBounds(15,120,140,20); 478 | panel2.add(workinghourlblpt); 479 | 480 | shiftslblpt = new JLabel("SHIFTS"); 481 | shiftslblpt.setBounds(15,180,140,20); 482 | panel2.add(shiftslblpt); 483 | 484 | wagesperhourlblpt=new JLabel("WAGES PER HOUR"); 485 | wagesperhourlblpt.setBounds(15,240,140,20); 486 | panel2.add(wagesperhourlblpt); 487 | 488 | addvacancynumberpt = new JButton("Add Vacancy"); 489 | addvacancynumberpt.setBounds(15,540,130,20); 490 | panel2.add(addvacancynumberpt); 491 | addvacancynumberpt.addActionListener(new ActionListener() 492 | { 493 | public void actionPerformed(ActionEvent ar){ 494 | partTimeAddVacancyMethod(); 495 | } 496 | }); 497 | 498 | appointvacancylblpt = new JLabel("Appointed Vacancy:"); 499 | appointvacancylblpt.setBounds(15,450,130,20); 500 | panel2.add(appointvacancylblpt); 501 | 502 | appointvacancytxtfldpt = new JTextField(); 503 | appointvacancytxtfldpt.setBounds(15,475,130,20); 504 | panel2.add(appointvacancytxtfldpt); 505 | 506 | appointbuttonpt = new JButton("Appoint Vacancy"); 507 | appointbuttonpt.setBounds(175,540,130,20); 508 | panel2.add(appointbuttonpt); 509 | appointbuttonpt.addActionListener(new ActionListener() 510 | { 511 | public void actionPerformed(ActionEvent aji){ 512 | partTimeAppointVacancyMethod(); 513 | } 514 | }); 515 | 516 | terminatevacancylblpt = new JLabel("Terminate Vacancy(for termination)"); 517 | terminatevacancylblpt.setBounds(220,450,220,20); 518 | panel2.add(terminatevacancylblpt); 519 | 520 | terminatevacancytxtfldpt = new JTextField(); 521 | terminatevacancytxtfldpt.setBounds(220,475,130,20); 522 | panel2.add(terminatevacancytxtfldpt); 523 | 524 | terminatebuttonpt = new JButton("TERMINATE"); 525 | terminatebuttonpt.setBounds(335,540,130,20); 526 | panel2.add(terminatebuttonpt); 527 | terminatebuttonpt.addActionListener(new ActionListener() 528 | { 529 | public void actionPerformed(ActionEvent add){ 530 | partTimeTerminateMethod(); 531 | } 532 | }); 533 | 534 | vacancynumbertxtfldpt = new JTextField(); 535 | vacancynumbertxtfldpt.setBounds(15,85,140,20); 536 | panel2.add(vacancynumbertxtfldpt); 537 | 538 | designationtxtfldpt = new JTextField(); 539 | designationtxtfldpt.setBounds(220,85,140,20); 540 | panel2.add(designationtxtfldpt); 541 | 542 | jobtypetxtfldpt = new JTextField(); 543 | jobtypetxtfldpt.setBounds(220,145,140,20); 544 | panel2.add(jobtypetxtfldpt); 545 | 546 | staffnametxtfldpt = new JTextField(); 547 | staffnametxtfldpt.setBounds(15,355,130,20); 548 | panel2.add(staffnametxtfldpt); 549 | 550 | qualificationtxtfldpt = new JTextField(); 551 | qualificationtxtfldpt.setBounds(15,415,130,20); 552 | panel2.add(qualificationtxtfldpt); 553 | 554 | joiningdatetxtfldpt = new JTextField(); 555 | joiningdatetxtfldpt.setBounds(220,355,130,20); 556 | panel2.add(joiningdatetxtfldpt); 557 | 558 | appointedbytxtfldpt = new JTextField(); 559 | appointedbytxtfldpt.setBounds(220,415,130,20); 560 | panel2.add(appointedbytxtfldpt); 561 | 562 | workinghourtxtfldpt = new JTextField(); 563 | workinghourtxtfldpt.setBounds(15,145,140,20); 564 | panel2.add(workinghourtxtfldpt); 565 | 566 | shiftstxtfldpt = new JTextField(); 567 | shiftstxtfldpt.setBounds(15,205,140,20); 568 | panel2.add(shiftstxtfldpt); 569 | 570 | wagesperhourtxtfldpt = new JTextField(); 571 | wagesperhourtxtfldpt.setBounds(15,265,140,20); 572 | panel2.add(wagesperhourtxtfldpt); 573 | 574 | clearbtnpt = new JButton("CLEAR"); 575 | clearbtnpt.setBounds(290,600,100,40); 576 | panel2.add(clearbtnpt); 577 | clearbtnpt.addActionListener(new ActionListener() 578 | { 579 | public void actionPerformed(ActionEvent ad){ 580 | partTimeClearMethod(); 581 | 582 | } 583 | }); 584 | 585 | displaybtnpt = new JButton("DISPLAY"); 586 | displaybtnpt.setBounds(90,600,100,40); 587 | panel2.add(displaybtnpt); 588 | displaybtnpt.addActionListener(new ActionListener() 589 | { 590 | public void actionPerformed(ActionEvent aj){ 591 | displayMethodPT(); 592 | } 593 | }); 594 | 595 | previousbtnpt = new JButton("BACK"); 596 | previousbtnpt.setBounds(190,600,100,40); 597 | panel2.add(previousbtnpt); 598 | previousbtnpt.addActionListener(new ActionListener() 599 | { 600 | public void actionPerformed(ActionEvent aer){ 601 | partTimeBackMethod(); 602 | } 603 | }); 604 | 605 | } 606 | //Creating a partTimeMethod. This method contains all the neccary JLabel,JTextField, JButton along with decentralized method of actionListener method for PART TIME panel. 607 | public void partTimeAddVacancyMethod(){ 608 | int vacancynumber,wages, workinghour; 609 | 610 | String vacancynum = vacancynumbertxtfldpt.getText(); 611 | String designation = designationtxtfldpt.getText(); 612 | String jobtype = jobtypetxtfldpt.getText(); 613 | String workinghr = workinghourtxtfldpt.getText(); 614 | String shifts = shiftstxtfldpt.getText(); 615 | String wagesperhour = wagesperhourtxtfldpt.getText(); 616 | if(vacancynum.trim().equals("")||designation.trim().equals("")||jobtype.trim().equals("")||workinghr.trim().equals("")||shifts.trim().equals("")|wagesperhour.trim().equals("")) 617 | { 618 | JOptionPane.showMessageDialog(frame,"Please fill all the fields","ERROR",0); 619 | } 620 | else{ 621 | try{ 622 | vacancynumber=Integer.parseInt(vacancynum); 623 | wages = Integer.parseInt(wagesperhour); 624 | workinghour = Integer.parseInt(workinghr); 625 | if(list.size()==0){ 626 | PartTimeStaffHire pu = new PartTimeStaffHire(vacancynumber,designation,jobtype,workinghour,wages,shifts); 627 | list.add(pu); 628 | JOptionPane.showMessageDialog(frame,"Successfully added staff","Result", JOptionPane.INFORMATION_MESSAGE); 629 | 630 | }else{ 631 | for (StaffHire s : list){ 632 | if (s instanceof PartTimeStaffHire){ 633 | PartTimeStaffHire pt = (PartTimeStaffHire)s; 634 | if(pt.getVacancyNumber()==vacancynumber){ 635 | JOptionPane.showMessageDialog(frame,"vacancy already exists","Error",0); 636 | }else{ 637 | PartTimeStaffHire pu = new PartTimeStaffHire(vacancynumber,designation,jobtype,workinghour,wages,shifts); 638 | list.add(pu); 639 | JOptionPane.showMessageDialog(frame,"Staff has been successfully added.","Result", JOptionPane.INFORMATION_MESSAGE); 640 | 641 | } 642 | } 643 | } 644 | } 645 | }catch(NumberFormatException nfe){ 646 | JOptionPane.showMessageDialog(frame,"Please enter in correct format","ERROR",0); 647 | return; 648 | } 649 | } 650 | } 651 | //Creating a method that adds the vacancy for partTimeStaffHire. 652 | public void partTimeAppointVacancyMethod(){ 653 | int appointvacancynumber; 654 | String appvacancynum = appointvacancytxtfldpt.getText(); 655 | String stfname = staffnametxtfldpt.getText(); 656 | String qlfi= qualificationtxtfldpt.getText(); 657 | String jnda = joiningdatetxtfldpt.getText(); 658 | String appby = appointedbytxtfldpt.getText(); 659 | if(appvacancynum.trim().equals("")||stfname.trim().equals("")||qlfi.trim().equals("")||jnda.trim().equals("")||appby.trim().equals("")) 660 | { 661 | JOptionPane.showMessageDialog(frame,"Please fill the field","Error",0); 662 | } 663 | else{ 664 | try{ 665 | appointvacancynumber = Integer.parseInt(appvacancynum); 666 | boolean condition=false; 667 | for(int i = 0;i < list.size(); i++){ 668 | StaffHire s = list.get(i); 669 | if(s instanceof PartTimeStaffHire){ 670 | PartTimeStaffHire pt = (PartTimeStaffHire)s; 671 | if(pt.getVacancyNumber()==appointvacancynumber){ 672 | pt.partTimeStaff(stfname,jnda,qlfi,appby); 673 | JOptionPane.showMessageDialog(frame,"Staff has been hired successfully","Result",JOptionPane.INFORMATION_MESSAGE); 674 | condition=true; 675 | break; 676 | } 677 | } 678 | } 679 | if(!condition){ 680 | JOptionPane.showMessageDialog(frame,"Vacancy number not found","Error",JOptionPane.INFORMATION_MESSAGE); 681 | return; 682 | } 683 | }catch(NumberFormatException nfe){ 684 | JOptionPane.showMessageDialog(frame,"Please enter in correct format","Error",0); 685 | return; 686 | } 687 | } 688 | } 689 | //Creating a method that appoints the vacancy for partTimeStaffHire. 690 | public void partTimeClearMethod(){ 691 | 692 | vacancynumbertxtfldpt.setText(""); 693 | designationtxtfldpt.setText(""); 694 | jobtypetxtfldpt.setText(""); 695 | staffnametxtfldpt.setText(""); 696 | qualificationtxtfldpt.setText(""); 697 | joiningdatetxtfldpt.setText(""); 698 | appointedbytxtfldpt.setText(""); 699 | workinghourtxtfldpt.setText(""); 700 | shiftstxtfldpt.setText(""); 701 | wagesperhourtxtfldpt.setText(""); 702 | appointvacancytxtfldpt.setText(""); 703 | terminatevacancytxtfldpt.setText(""); 704 | 705 | JOptionPane.showMessageDialog(frame,"All the textfields have been cleared.","Result",JOptionPane.INFORMATION_MESSAGE); 706 | } 707 | //Creating a method that clears all the arguements in the JTextField of PART TIME panel 708 | public void partTimeTerminateMethod(){ 709 | 710 | String vacancyNum = terminatevacancytxtfldpt.getText().trim(); 711 | int termNum; 712 | if(vacancyNum.equals("")){ 713 | JOptionPane.showMessageDialog(frame, "Please fill the Field", "Error", JOptionPane.ERROR_MESSAGE); 714 | }else{ 715 | try{ 716 | termNum = Integer.parseInt(vacancyNum); 717 | }catch(NumberFormatException abc){ 718 | JOptionPane.showMessageDialog(frame, "Please fill all the fields in correct format", "Error", JOptionPane.ERROR_MESSAGE); 719 | return; 720 | } 721 | boolean joined = false; 722 | for(StaffHire s: list){ 723 | if(s instanceof PartTimeStaffHire){ 724 | PartTimeStaffHire p = (PartTimeStaffHire)s; 725 | if(s.getVacancyNumber()==termNum){ 726 | joined= true; 727 | p.terminate(); 728 | list.remove(s); 729 | JOptionPane.showMessageDialog(frame,"Staff has been successfully terminated.","Terminated",1); 730 | break; 731 | } 732 | } 733 | } 734 | if(joined == false){ 735 | JOptionPane.showMessageDialog(frame, "The staff is not joined yet.", "Info", JOptionPane.INFORMATION_MESSAGE); 736 | } 737 | } 738 | } 739 | //Creating a method that terminates the appointed vacancy in the PartTimeStaffHire. 740 | public void displayMethodPT(){ 741 | for(StaffHire s: list){ 742 | if (s instanceof PartTimeStaffHire){ 743 | PartTimeStaffHire p = (PartTimeStaffHire)s; 744 | p.display(); 745 | } 746 | } 747 | } 748 | //Creating a method that displays all the arguments of the PART TIME in the terminal. 749 | public void partTimeBackMethod(){ 750 | panel2.setVisible(false); 751 | panel.setVisible(true); 752 | } 753 | //Cerating a method that closes the panel of PART TIME. 754 | public static void main(String[]args){ 755 | new INGNepal().frame.setVisible(true); 756 | } 757 | //main method of the class INGNepal.The main function where the compiler starts the execution. 758 | } -------------------------------------------------------------------------------- /PartTimeStaffHire.java: -------------------------------------------------------------------------------- 1 | public class PartTimeStaffHire extends StaffHire 2 | { 3 | private int workingHour; 4 | private int wagesPerHour; 5 | private String staffName; 6 | private String joiningDate; 7 | private String qualification; 8 | private String appointedBy; 9 | private String shifts; 10 | private boolean joined; 11 | private boolean terminated; 12 | public PartTimeStaffHire(int vacancyNumber,String Designation,String jobType,int workingHour,int wagesPerHour,String shifts) 13 | { 14 | super(vacancyNumber,Designation,jobType); 15 | this.workingHour = workingHour; 16 | this.wagesPerHour = wagesPerHour; 17 | this.shifts = shifts; 18 | staffName = ""; 19 | joiningDate = ""; 20 | qualification = ""; 21 | appointedBy = ""; 22 | joined = false; 23 | terminated = false; 24 | } 25 | // a constructor is called to create objects. 26 | public int getWorkingHour() 27 | { 28 | return workingHour; 29 | } 30 | //getter method used to get the instance workingHour. 31 | public void setWorkingHour() 32 | { 33 | this.workingHour = workingHour; 34 | } 35 | //setter method used to set the workingHour. 36 | public int getWagesPerHour() 37 | { 38 | return wagesPerHour; 39 | } 40 | //getter method used to get the instance WagesPerHour. 41 | public void setWagesPerHour() 42 | { 43 | this.wagesPerHour = wagesPerHour; 44 | } 45 | //setter method used to set the wagesperhour. 46 | public String getStaffName() 47 | { 48 | return staffName; 49 | } 50 | //getter method used to get the instance staffname. 51 | public void setStaffName() 52 | { 53 | this.staffName = staffName; 54 | } 55 | //setter method used to set the staffName. 56 | public String getJoiningDate() 57 | { 58 | return joiningDate; 59 | } 60 | //getter method used to get the instance joiningDate. 61 | public void setJoiningDate() 62 | { 63 | this.joiningDate = joiningDate; 64 | } 65 | //setter method used to set the joiningDate. 66 | public String getQualification() 67 | { 68 | return qualification; 69 | } 70 | //getter method used to get the instance qualification. 71 | public void setQualification() 72 | { 73 | this.qualification = qualification; 74 | } 75 | //setter method used to set the qualification. 76 | public String getAppointedBy() 77 | { 78 | return appointedBy; 79 | } 80 | //getter method used to get the instance appointedBy. 81 | public void setAppointedBy() 82 | { 83 | this.appointedBy = appointedBy; 84 | } 85 | //setter method used to set the value of appoinedBy. 86 | public String getShifts() 87 | { 88 | return shifts; 89 | } 90 | //getter method used to get the instance value of shift. 91 | public void setShifts() 92 | { 93 | this.shifts = shifts; 94 | } 95 | //setter method used to set the value of shifts. 96 | public boolean getJoined() 97 | { 98 | return joined; 99 | } 100 | //getter method used to get the instance value of joined. 101 | public void setJoined() 102 | { 103 | this.joined = joined; 104 | } 105 | //setter method used to set the value of joined. 106 | public boolean getTerminated() 107 | { 108 | return terminated; 109 | } 110 | 111 | public void setTerminated() 112 | { 113 | this.terminated = terminated; 114 | } 115 | 116 | public void setShifts(String newShifts) 117 | { 118 | this.shifts = newShifts; 119 | } 120 | 121 | public void partTimeStaff(String staffName,String joiningDate,String qualification,String appointedBy) 122 | { 123 | if(joined ==true) 124 | { 125 | System.out.println("Staff Name :" +getStaffName()+ "joined on :" +getJoiningDate()); 126 | } 127 | else 128 | { 129 | this.staffName = staffName; 130 | this.joiningDate = joiningDate; 131 | this.qualification = qualification; 132 | this.appointedBy = appointedBy; 133 | joined = true; 134 | terminated = false; 135 | } 136 | } 137 | 138 | public void terminate() 139 | { 140 | if(terminated == true) 141 | { 142 | System.out.println("Staff has been terminated"); 143 | } 144 | else 145 | { 146 | this.staffName = ""; 147 | this.joiningDate = ""; 148 | this.qualification = ""; 149 | this.appointedBy = ""; 150 | this.joined = false; 151 | this.terminated = true; 152 | } 153 | } 154 | 155 | public void display() 156 | { 157 | super.display(); 158 | if(joined == true) 159 | { 160 | System.out.println("The new hired staff name is = " +getStaffName()+ "\nWages Per Hour =" +getWagesPerHour()+ 161 | "\nJoined Date = " +getJoiningDate()+ "\nQualification of staff =" +getQualification()+ 162 | "\nAppointed By = " +getAppointedBy()+ "\nsalary worth per day = " +(workingHour*wagesPerHour)); 163 | } 164 | }// this is a method which displays the value to be printed. 165 | } 166 | 167 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # StaffHireSystem---JAVA-Programming 2 | Just download all the java files. 3 | After that u can simply download JDK. 4 | Install it and set a path in the environmental variables. 5 | (after installing u will find a java folder in the path that u installed the JDK. Then open the folder and u will find bin folder go ahead and open it and copy the path 6 | up to bin folder. Then go to your environment variables, under the system variables u will see path click on it and make a new path and paste the path that u had copied.) 7 | Finally, u are ready to go. 8 | Just open command go the path where u downloaded the java file and just run it. 9 | -------------------------------------------------------------------------------- /StaffHire.java: -------------------------------------------------------------------------------- 1 | public class StaffHire 2 | { 3 | private int vacancyNumber; 4 | private String designation; 5 | private String jobType; 6 | 7 | public StaffHire (int vacancyNumber, String designation, String jobType) 8 | { 9 | this.vacancyNumber=vacancyNumber; 10 | this.designation=designation; 11 | this.jobType=jobType; 12 | } 13 | //A method which initializes the object of the attribute. Like in StaffHire we have vacancyNumber, designation, joiningDate 14 | //which are set on the class StaffHire and allocates the memory for that following object. 15 | public int getVacancyNumber() 16 | { 17 | return vacancyNumber; 18 | } 19 | //This method reads the integer value of the variable vacancyNumber and this value can also be accessed by other class when called. 20 | public String getDesignation() 21 | { 22 | return designation; 23 | } 24 | //This method reads the integer value of the variable vacancyNumber and this value can also be accessed by other class when called. 25 | public String getJobType() 26 | { 27 | return jobType; 28 | } 29 | //This method reads the integer value of the variable jobtype which can also be accessed by other classes when called. 30 | public void setVacancyNumber(int vacancyNumber) 31 | { 32 | this.vacancyNumber=vacancyNumber; 33 | } 34 | //this method is used to set the value of valancyNumber. 35 | public void setDesignation(String designation) 36 | { 37 | this.designation=designation; 38 | } 39 | //this method is used to set the value of designation. 40 | public void setJobType(String jobType) 41 | { 42 | this.jobType=jobType; 43 | } 44 | //this method is used to set the value of jobtype. 45 | public void display(){ 46 | System.out.println("VacancyNumber = "+vacancyNumber ); 47 | System.out.println("Designation = " +designation ); 48 | System.out.println("Type of job = "+jobType); 49 | } 50 | //this method is used to display suitable message with their respective attribute. 51 | 52 | } 53 | --------------------------------------------------------------------------------