CS1102 Programming 1-Project assignment unit 5 Solved

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: zip solution files instantly, after Payment

Securely Powered by: Secure Checkout

Description

5/5 - (5 votes)

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 having the main method.

Step 2: Creating new classes

To create a new class, simply right click on “payrollsystem” package name and select new -> java class.

You will need four classes for this project.

Employee class

FullTime class

PartTime class

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.

  • Unit5.zip