Question: Create a class called Employee that should include four pieces of information as instance variablesa firstName (type String ), a lastName (type String ), a

Create a class called Employee that should include four pieces of information as instance variablesa firstName (type String), a lastName (type String), a mobileNumber (type String) and a salary (type int).

1) Your class (Employee) should have a full argument constructor that initializes the four instance variables.

2) Provide a set and a get method for each instance variable. The validation for each attribute should be like below:

a. mobileNumber should be started from 05 and the length will be limited to 10 digits.

b. salary should be greater than zero.

3) In addition, provide a method named getYearlySalary() that calculates the yearly salary (i.e., multiplies the salary by 12), then returns the amount as a double value.

4) The toString() print the following information

- Employee Name: FirstName LastName

- Mobile No. 0512345678

- Employee Salary: 2000

5) Override the equals() method to return the true if the current Employee object has the same firstName and lastName fields as the Employee object referenced by the input argument and false otherwise.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!