Question: Computer Programming II (Adv. Java) Information Create a class called Employee that should include four pieces of information as instance variables - a firstName (type

Computer Programming II (Adv. Java)

 Computer Programming II (Adv. Java) Information Create a class called Employee
that should include four pieces of information as instance variables - a

Information Create a class called Employee that should include four pieces of information as instance variables - a 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 getYearlySalary0 that calculates the yearly salary (i.e., multiplies the salary by 12 ), then returns the amount as a double value. 4) The toString0 print the following information Employee Name: FirstName LastName Mobile No. 0512345678 Employee Salary: 2000 5) Override the equals 0 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. Derived Class Information 1) Create another class called SalesEmployee which inherits all the properties of Employee Class. The SalesEmployee should include specific attributes- a sales (type int) and a commissionRate (type double). 2) SalesEmployee Class should have a full argument constructor that initializes the SIX instance variables (Base Class (4) and Derived Class (2)). Call constructor of base class, i.e., Employee class from derived class (SalesEmployee) constructor as below: a. Super (fname, Iname, mobile, salary) 3) Provide a set and a get method for each specific attribute of SalesEmployee class. 4) Override the getYearlySalary() method in SalesEmployee class to calculate the salary as below: return ((super.salary +( sales commissionRate ) ) 12); 6) The toString0 print the following information Employee Name: FirstName LastName Mobile No, 0512345678 Sales Employee Salary: 22000 3. Override the equals 0 method to return the true if the current SalesEmployee object has the firstName, lastName, and sales fields as the SalesEmployee object referenced by the input argument and false otherwise. Important Note 3: Make sure to call the equals() method of the SalesEmployee class. InheritanceTest Class Information 1) Write a test app named InheritanceTest that demonstrates class Employee and SalesEmployee classes capabilities. 2) Create an object (i.e., empObj) of Employee class and print all the information in the defined toString() method format. 3) Create an object (i.e., SalesEmpObj) of SalaesEmployee class and print all the information in the defined toString() method format

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!