0% found this document useful (0 votes)
31 views5 pages

Practical Activity 1 2024

This document provides instructions for developing an employee payroll system. It includes: 1. Creating a project in NetBeans called "Employee Salary Processing App" and adding an Employee class to store employee data like name, type, salary, etc. 2. Designing a GUI with text fields to enter employee details and radio buttons to select the employee type (hourly, salaried, manager). 3. Coding buttons to add employees to an arraylist, display employee details and calculate weekly pay. Validation and exception handling is required. 4. Writing code to filter and display hourly, salaried or all employees from the arraylist based on button clicks. 5. Hiding

Uploaded by

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

Practical Activity 1 2024

This document provides instructions for developing an employee payroll system. It includes: 1. Creating a project in NetBeans called "Employee Salary Processing App" and adding an Employee class to store employee data like name, type, salary, etc. 2. Designing a GUI with text fields to enter employee details and radio buttons to select the employee type (hourly, salaried, manager). 3. Coding buttons to add employees to an arraylist, display employee details and calculate weekly pay. Validation and exception handling is required. 4. Writing code to filter and display hourly, salaried or all employees from the arraylist based on button clicks. 5. Hiding

Uploaded by

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

SEMESTER/EXAMINATION

TEST /ASSIGNMENT COVER


PAGE

FACULTY OF APPLIED & COMPUTER SCIENCES

DEPARTMENT OF COMPUTER SCIENCE

DIPLOMA: INFORMATION TEHNOLOGY

SUBJECT : DEVELOPMENT SOFTWARE 3.1


SUBJECT CODE : ASDSX3A
FORMATIVE ASSESSMENT :
DATE : FEBRUARY 2024
DURATION : HOURS
EXAMINER(S) : MRS S MOYO
MODERATOR(S) : MR N SOGANILE

MARKS: Total = 100


Full marks = 100

[ASDSX3A] [2024 FEBRUARY]


Page 1 of 5
QUESTION 1 [Marks]

Problem Statement:

Best Buys Furniture Warehouse is a company that makes and sells quality
furniture. They have 3 types of employees:

• Hourly employees -get paid an hourly wage, but if they work more than
40 hours per week, the excess is paid at “time and a half”.
• Salaried employees -get paid their salary, no matter how many hours
they work.
• Managers -are salaried employees who get paid a salary and a bonus.

You are required to develop a system that will store employees details and
Calculate their weekly pay.

Follow the following steps to create the required system:

1.Using the NetBeans IDE, create a project and name it Employee Salary

Processing App (see Figure 1)

2. Create a Java package naming it vut and in it create a Java class Employee.

▪ The Employee class should store the following as attributes: the name of
an employee, the cell phone number, employee type- salaried,
manager and hourly, annual salary, hourly wage, weekly bonus
▪ Code the default and parametrized constructor for the class.
▪ Code mutators and accessors for all the attributes validating user
input. The name of an employee cannot have less than 3 characters, the
cell phone number must have 10 digits and begin with zero (0). Annual
salary, weekly bonus, and hourly wage cannot be negative.
• Create a method named calculatePay to receive as a parameter the
hours worked by an employee and calculate the weekly pay for the
employee.
o The weekly pay for hourly employees is calculated by multiplying
the hours worked by the employee times the hourly wage, but if
they work more than 40 hours per week, the excess is paid at “time
and a half”.

2
o The annual salary is used to calculate the weekly pay for salaried
employees and managers no matter how many hours they work.
But managers also get a weekly bonus on top of their weekly
salary.
• Code the toString method to display the name, employee type, cell #,
the annual salary, and the hourly wage of an employee.

Figure 1

3. Use the GUI shown in Figure 2 for the system, naming the class of the form,
EmployeeForm as shown in Figure 1. The GUI should be stored in the
vut.gui package. Rename the textFields, radio buttons and buttons
appropriately.

Figure 2

4. Code the ActionPerformed event of the addEmployee button as follows:


▪ Check if the user has entered input in the text fields and display an
appropriate message if the text fields are empty otherwise check which
radio button is selected, create an object of the employee class
appropriately and store the object in an array list.
▪ Catch exceptions using try-catch .

3
▪ Display the created object by calling the toString method of the
Employee class together with the calculated weekly pay for the employee
as in Figure 3, Figure 4 and Figure 5.

5.Write code in the ActionPerformed event procedure of the View Hourly


Employee button to display in the text area only the hourly employees saved in
the array list.

6. Write code in the ActionPerformed event procedure of the View Salaried


Employee button to display in the text area All salaried employees saved in the
array list including managers.

Figure 3

Figure 4

4
Figure 5

6. Note that when the hourly employee option button is selected, the
annual salary text field and the weekly bonus text field are not visible and
when the salaried option button is selected, the hourly wage text field and
the weekly bonus text field are not visible and when the manager option
button is selected, the hourly wage text field is not visible.
Code the ActionPerformed event procedures of the option buttons accordingly.

*****************The End***************Good Luck*******************

You might also like