Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objective: Create a Java program to develop skills implementing Java syntax, including: -Compile and run a simple program, -Design class definitions Declare class variables -Create

image text in transcribed
image text in transcribed
Objective: Create a Java program to develop skills implementing Java syntax, including: -Compile and run a simple program, -Design class definitions Declare class variables -Create class instances (objects) Define instance methods -Define constructors, getters and setters -Utilize inheritance -Implement a Java interface Overview In this assignment you are given a partial project that has a graphical interface that will allow users to create employees. You will create an interface file and two classes which will be used to represent two types of employees. Using the superclass of Employee and the interface of Payroll you will create two subclasses Hourly and Commission that will be used to calculate their biweekly pay amount. The graphical application has all the necessary logic to make the application work. If you have issues getting the application to function; then please check how you have implementation. Helpful tip: To get some input from users in the graphical environment a simple way is to use a p dialog name JOptionPane.showInputDialogO. This method takes a String argument which is displayed within the dialog box, when the user closes the popup a String is returned. (See https:l/docs.oracle.com/javase/tutorial/uiswing/components/dialog.html popu http://docs.oracle.com/javase/8/docs/api) Steps: 1. Add a new interface named Payroll to the project that will be used to force all the derived classes of the Employee class to define the methods below. setPayPeriodDetails0 - This method takes no parameters and has a return type of void. The method will ask for and store in the object any information that is needed to calculate the pay for the employee for one payment period. calculatePay0 - This method takes no parameters and has a return type of double. The method uses the information collected by setPayPeriodDetails0 and calculates the money owed to the employee for the pay period. a. b. Note - This is an interface; no body functions are allowed. The details of these methods will be defined later. the 2. Add a new class named Hourly. Ensure this class uses the Employee class and interface Payroll. An hourly employee's pay is calculated by taking their hourly rate and multiplying it by the hours worked. a Add any class attributes that will be required, keeping them all private. Create a constructor that will set their employee number, name and their regular pay rate. setPayPeriodDetailso - Implement this method for the Hourly class. Since the pay period is every two week you will need to ask the user how many hours are worked in each of the two wecks. Stored this information in the object for use later on caleulatePay0- Implement this method for the Hourly class. This method will use the employee's hourly rate and the number of hours worked of each week c. d. and return the total pay due to the employee for this payment period. If any hourly employee works more than 40 hours in a vw multiplied by the overtime rate which is defined as 1.5 times their regular rate. epk-the hours over 40 will be , e. Create the toString) method in the Hourly class. It takes no parameters and returns a String. This method will use the Employee toString0 method and construct a string that includes the class type, the employee name, the employee id and the pay period payment amount Add a new class named Commission. Ensure this class uses the Employee class and the interface Payroll. A commission employee's pay is calculated by taking their sales for the pay period and multiplying it by commission percentage. For case of entry this number will be stored as a typical percent. For example if the employee will be paid 3. 7.5% on his sales then the percentage should be stored as 7.5. a. b. Add any class attributes that will be required; keeping them all private. Create a constructor that will set their employee number, name and their commission rate. c. setPayPeriodDetails0 Implement this method for the Commission class. d. calculatePay0 -Implement this method for the Commission class. This e. Create the toString0 method in the Commission class. It takes no parameters This method will need to ask the user what the sales were for the current pay period. Stored this information in the object for use later on. method will use the sales and multiply it by the commission rate to determine the resulting pay due to the employee for this payment period. and returns a String. This method will use the Employee toString0 method and construct a string that includes the class type, the employee name, the employee id and the pay period payment amount

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_2

Step: 3

blur-text-image_3

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

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

More Books

Students also viewed these Databases questions