Create an abstract class Staff which has two protected instance variables - staffcode type String, staffName type String

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Create an abstract class Staff which has two protected instance variables - staffcode type String, staffName type String

Post by answerhappygod »

Create An Abstract Class Staff Which Has Two Protected Instance Variables Staffcode Type String Staffname Type String 1
Create An Abstract Class Staff Which Has Two Protected Instance Variables Staffcode Type String Staffname Type String 1 (68.65 KiB) Viewed 56 times
Create an abstract class Staff which has two protected instance variables - staffcode type String, staffName type String and performs the following tasks. a. Provide a constructor that initializes the instance variable. b. Provide get and set methods for each of the instance variables. c. Provide an abstract method name calsalary and return type is double. d. Provide a method tostring to return the staffcode and staffName. Create a class Engineering which inherits from the staff and has two instance variables - experience type int and salary type double and performs the following tasks. a. Provide a constructor that initializes the instance variables the engineering and of super class. b. Add a method called salsalary which returns the calculated salary depending on experience. If the experience is zero it return the same salary, if the experience is > 2 and <= 4 it will return (salary + salary * 0.10) and else it will return (salary + salary * 0.50). c. Add a method called tostring which returns to return the staffCode, staffName, experience, and calculated salary. Create a class StaffApr, which performs the following tasks. a. Read the atat cade, stafenaue, experience and salary from the user. b. Create an object for Staft with Engineering class. c. Display the information OUTPUT: Enter staff code : : 01A45 Enter staff name :: Abdul Latif Enter experience :: 3 Enter salary :: 2451.45 Staff information Staff code - 01A45 Staff name – Abdul Latif Experience - 3 Salary - SR 2451.45 Net salary - SR 2696.60
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply