Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This needs to be in Java... Question 31 Note that for this question, a template for the PayrollProcess class is provided for you, you just

This needs to be in Java...

Question 31 Note that for this question, a template for the PayrollProcess class is provided for you, you just need to fill in the template for that class. In the spaces provided, write an Object Oriented program incorporating Abstraction, Encapsulation, Polymorphism and Inheritance that uses an array of Employees as an attribute of a PayrollProcess object with two of each of the following types of employees: Contractor name hourly rate: $60 hours per week: 20 tax rate: 13% (that is, 0.13) (only contractors have this property) method of payment: mail a check weekly payroll calculation: hours x rate x (1 + tax rate) Regular name hourly rate: $30 hours per week: 37.5 deduction rate: 40% (that is, 0.40) (only regular employees have this property) method of payment: direct deposit weekly payroll calculation: hours x rate x (1 deduction rate) Write down three Java classes, including an abstract Employee class with abstract methods, to represent these employees. Implement the hourly rate, hours per week, tax rate and deduction rate as attributes, and consider the method of payment and calculation to be behaviors. Implement the method of payment behavior by printing out a suitable string when the payment is made. For example, your payment method could take an amount parameter, and consist of a single line: System.out.println("Direct depositing " + amount + " to " + name + "'s bank account"); Your method for calculating the payment will (most likely) be a function that returns a double. The constructor for your Contractor and Regular classes will accept a name as a parameter, and initialize the hourly rate and hours per week to the values given above. See the template for the PayrollProcess class provided in the following questions. After initializing your array with four employees, two of each (make up the names), process the payroll by iterating through the array, and for each employee, calculate the amount owed to that employee and pass that as a parameter to the employees payment method. You DO need to write the code that performs the calculation (do not just hard-code the numbers 1356 and 675) because although the attributes do not change in this program, the program will be enhanced to support changes to the attributes at a later time by one of your co-workers. (Note: Same concept as ChequingAccount & SavingsAccount objects as objects of Account class). Sample output from the program is shown below: Mailed a cheque to John for 1356.0 Mailed a cheque to Lucy for 1356.0 Direct depositing 675.0 to Jack's bank account Direct depositing 675.0 to Jill's bank account // main method for your program (you won't change this) public static void main (String[] args) { PayrollProcess payroll = new PayrollProcess(); payroll.process(); } 32 is create a array 33 is a enhanced loop and call some method u wirte on 31\ 1-30 is mulitple choice' excatly same to wat u did on hyb5 midterm practice

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

Recommended Textbook for

Inference Control In Statistical Databases From Theory To Practice Lncs 2316

Authors: Josep Domingo-Ferrer

2002nd Edition

3540436146, 978-3540436140

More Books

Students also viewed these Databases questions

Question

demonstrate the importance of induction training.

Answered: 1 week ago