Write a program using inheritance to do the following tasks: a) Create an abstract class Employee with the variables id, name and salary. b) Declare an abstract method calculateTax(double) which calculates the Tax on Salary of an employee. c) Inherit the class Employee into a subclass Employee Tax. In Employee Tax class do the following tasks: i) Create a method getEmployeeDetails() to read id, name and salary of an employee. ii) Inside the calculate Tax() method calculate the tax using the following conditions.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 10PE
icon
Related questions
Question
Instructions:
Add your student id and name as comment in your program.
Copy and paste your solution in the space provided. Also upload your file as an attachment.
Images/pictures of your code is not accepted.
Write a program using inheritance to do the following tasks:
a) Create an abstract class Employee with the variables id, name and salary.
b) Declare an abstract method calculateTax(double) which calculates the Tax on Salary of an employee.
c) Inherit the class Employee into a subclass Employee Tax. In Employee Tax class do the following tasks:
i) Create a method getEmployeeDetails) to read id, name and salary of an employee.
ii) Inside the calculate Tax() method calculate the tax using the following conditions.
Salary
Tax
>=2000
20%
>=1500
15%
>=1000
10%
<1000
5%
iii) Create a method netsalary) in the subclass to print the salary.
Note: salary=salary-tax
Transcribed Image Text:Instructions: Add your student id and name as comment in your program. Copy and paste your solution in the space provided. Also upload your file as an attachment. Images/pictures of your code is not accepted. Write a program using inheritance to do the following tasks: a) Create an abstract class Employee with the variables id, name and salary. b) Declare an abstract method calculateTax(double) which calculates the Tax on Salary of an employee. c) Inherit the class Employee into a subclass Employee Tax. In Employee Tax class do the following tasks: i) Create a method getEmployeeDetails) to read id, name and salary of an employee. ii) Inside the calculate Tax() method calculate the tax using the following conditions. Salary Tax >=2000 20% >=1500 15% >=1000 10% <1000 5% iii) Create a method netsalary) in the subclass to print the salary. Note: salary=salary-tax
Expert Solution
steps

Step by step

Solved in 4 steps with 7 images

Blurred answer
Knowledge Booster
Reference Types in Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT