Question: 1. Write a Java program to find power of a number using recursion, ex: 2^3 = 8. (3 marks) 2. Array of objects: (7
1. Write a Java program to find power of a number using recursion, ex: 2^3 = 8. (3 marks) 2. Array of objects: (7 marks) a. Write a java program to implement an employee class. The class has three fields name,salary, and years of experience. b. Create a constructor that accepts 3 paratemeters (name, salary, and years of experience). c. Write 3 accessor methods to return the values of all fileds above. d. Write 3 setter methods to change the value of all fileds above. e. Write ConditionalChangeSalary() that checks the years of experience of the employee object. If the years of experience >10, then the salary of employee is increased by 2000 SR, otherwise no change occurs. f. Finally, build toString() method to return string representation of all the fileds. g. Create a main method that creates one object of employee class and call the methods you built previously on this object. h. Create array of employee objects. i. Use for loop to Create 3 employee objects (stored in the array) & initialize employee objects using constructor. j. Use for loop to set the values of all fields of the three employee objects using the setter methods you built previousely. k. Use for loop to increase the salary of three employee objects based on the ConditionalChangeSalary() method created above. I. ALSO, use for loop to print the values of objects' fileds using the toString() method built previously.
Step by Step Solution
3.42 Rating (152 Votes )
There are 3 Steps involved in it
Here is a Java program that fulfills your requirements class Employee private String name private do... View full answer
Get step-by-step solutions from verified subject matter experts
