Question: (Please the code in java) (Im using Eclipse to code) In this assignment, we use encapsulation to protect and control our data. 1. Open a
(Please the code in java)
(Im using Eclipse to code)
In this assignment, we use encapsulation to protect and control our data.
1. Open a new class called Employeesecure and define three private fields as Name, Hours and Rate.
2. Write getter and setter methods for accessing and changing these three fields. For example for Name:
public void setName(String a){ Name=a; } public String getName(){ Return Name } Note: when you are writing setter and getter methods for Hours and Rate, apply the following rules:
a) Hourly employees be paid at least $8.00 an hour. (In the setter method, create an error for entering values that are less than $8.) b) An employee not work more than 60 hours in a week. (In the setter method, create an error for entering values more than 60 hours.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
