Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The goal of this simple payroll system project is twofold: a) serve as a case-study and b) give students the opportunity to connect the dots

The goal of this simple payroll system project is twofold: a) serve as a case-study and b) give students the opportunity to connect the dots and implement a full-fledged (albeit simple) application using most of Object-Oriented Programming. Understanding this project, by implementing, testing and debugging it, should provide students with the necessary OOP foundation (classes, information hiding, inheritance and polymorphism) so widely used in real-world applications nowadays. The project, spanning across a few chapters, is developed on a step-by-step basis, starting in unit 5, moving on to inheritance and polymorphism and finally putting it all together in unit 8. All you have to do is to follow the step-by-step instructions, creating your own application and submitting your project via Moodle. At the end of unit 8, you should have a program for a Simple Payroll System in Java that:

Keeps a list of employees: Id, Name, Vehicle in the parking lot (if applicable)

Enter and save the payroll information: Salary, Bonus, Hourly rate, worked hours

Store employee information to an ArrayList.

Calculate the payroll

Unit 5 - The first step is to create the necessary classes to the project: Employee, PartTime, FullTime and Vehicle. The main application, which makes use of those classes, is also created here (PayrollSystem). Creating classes and start working with inheritance.

Step 1: Creating Project

After this step you will have a package name "payrollsystem" in which you will have "PayrollSystem.java" class havingthemain method.

Step 2: Creating new classes

To make anew class, simply right click on "payrollsystem" package name and select new -> java class.

You will need four classes for this project.

  1. Employee class

  1. FullTime class

  1. PartTime class

  1. Vehicle class

Step 3: Creating getters and setters.

For example: While working on Employee class, you have three instance variables.

Right click anywhere in the editor and choose Refactor option and then Encapsulate fields. See image below for details.

You will get this window.

Select the fields whose getters and setters methods you want to be created. For the Employee class you need getters and setters for all the fields (therefore they should all be checked off). Click on Refactor button.

Netbeans will, automatically, create getter and setter methods for the chosen fields. Example getEmpId and setEmpId.

Step 4: Start working with inheritance

FullTime and PartTime classes are subclasses or child classes of the Employee class also called parent class.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions

Question

1. What are the three common elements of an economic game?

Answered: 1 week ago

Question

Convert the following Mealy Machine into a Moore Machine.

Answered: 1 week ago