Question: Java 1. Define a class Employee with following members: Data Members: Modifier. Description. Data Type. Name Private. Employee number. Integer. Eno Private Employee Name. String.
Java
1. Define a class Employee with following members:
Data Members:
Modifier. Description. Data Type. Name
Private. Employee number. Integer. Eno
Private Employee Name. String. Ename
Private. Number of. Array double[7] Hours[7]
hours worked for each day
Private. Salary for each day. Arraydouble[7]. Salary[7]
Private. Per hour salary. double. Rate
Private. Gross Salary. double. Gross_Salary
Methods
Modifier. Name. Description
Employee(). Constructor to assign values to blanks or 0
Public. Input(). Method to take the input of Eno, Ename, Hours [7], Rate and call Calculate()
Public. Display(). To display the contents of all fields
Public. Calculate(). Calculates the salary for each day as per the table below, and then calculates Gross_Salary
The Salary for each day is calculated as per the following criteria:
First 8 hours are paid as per the hourly rate.
Next 4 hours are paid at the rate of 1.5*rate
Remaining hours are paid at the rate of 2*rate
Weekends are paid at the rate of 2*rate
The Input method should verify that the number of hours have a valid input for each day (>=0 and <=24). Use appropriate code for the same.
The program should create an object of Employee and call the methods for doing the operations. The field values should be displayed in the end.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
