Create class Employee. • Use static variable an nualTaxRate to store the annual tax rate for all employees. Also use anothe static variable infl ationRate [0-1]. Use inline initi aliz ation for inflationRate = 0.3, whereas annualTaxRate is initi aliz edu sin g the following rule in a staticinit block. • If inflationRate is higher than 0.5, then annual Tax Rate is 5%, else annu al TaxRate is 10%. • Each object of the Employee class contains private in stancevari ables n ame andsalary indicating the employ ee n ame an dmon thly salary of the employee. • Provide constructor(s) and getter/sett er methods. The con str uctor and getter/setter methoc should use shadow ing parameters names. (hint: use 'this’). Add also a con structor that takes object as paramet er. • Provide methodcompute Annual Tax to calculate the monthly interest by multiplying the Annual salary by annu al TaxRate divided by 100 – this tax should be returnedfrom computeAnnualTax. Write class EmpTest for testingthe Employee class • Create an employee object emp1bycalling constructorswith appropriate values(salan = 20000). • Create anotheremployee object emp2having default salary (say 30000) • Create thi rd employee emp3 having the values same as emp2. • Inputsalary from userand update the salary of emp2 to the newsalary (say 50000). • Compute Annual tax for all the employees and display them in the test class. • Compare the salaries of each employee toshow the employee with the highest monthly salary. *Upd ate the employee class so that it contains another instance variable called netMonthly Income, which defined as monthly salary minus(-) monthly income tax. Add a method to the class Employee cale computeNetS alary to compute it.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Using JAVA 
Topic: Passing Objects and Returning Objects

Create class Employee.
Use static variable an nualTaxRate to store the annual tax rate for all employees. Also use another
static variable infl ationRate [0-1].
• Use inline initi alization for inflationRate= 0.3, whereas annualTaxRate is initi alizedu sing the
following rule in a staticinit block.
• If inflationRateis higher than 0.5, then annual Tx Rate is 5%, else annu alTaxRate is 10%.
• Each object of the Employee class contains private in stancevariables name andsalary indicating
the employ ee nameandmonthly salary of the employee.
• Provide constructor(s) and getter/sett er methods. The con structor and getter/setter methods
should use shadowing parameters names. (hint: use this'). Add also a con structor that
takes object asparameter.
• Provide methodcompute Annual Tax to calculate the m on thly interest by multiplying the Annual
salary by annu alTaxRate divided by 100 – this tax should be returnedfrom computeAnnualTax.
• Write class EmpTest for testingthe Employee class
• Create an employee object emp1bycalling constructorswith appropriate values(salary
= 20000).
• Create anotheremployee objectemp2having default salary (say 30000)
• Create thi rd employee emp3having the valuessame as emp2.
• Inputsalary from userand update the salary of emp2 to the newsalary (say 50000).
• Compute Annual tax for all the employeesand displaythem in the test class.
• Compare the salaries of each employee toshow the employee with the highest
monthly salary.
Upd ate the employee class so that it contains another instance variable called netMonthly Income, which is
defined as monthly salary minus(-) monthly income tax. Add a method to the class Employee called
computeNetSalary to compute it.
Transcribed Image Text:Create class Employee. Use static variable an nualTaxRate to store the annual tax rate for all employees. Also use another static variable infl ationRate [0-1]. • Use inline initi alization for inflationRate= 0.3, whereas annualTaxRate is initi alizedu sing the following rule in a staticinit block. • If inflationRateis higher than 0.5, then annual Tx Rate is 5%, else annu alTaxRate is 10%. • Each object of the Employee class contains private in stancevariables name andsalary indicating the employ ee nameandmonthly salary of the employee. • Provide constructor(s) and getter/sett er methods. The con structor and getter/setter methods should use shadowing parameters names. (hint: use this'). Add also a con structor that takes object asparameter. • Provide methodcompute Annual Tax to calculate the m on thly interest by multiplying the Annual salary by annu alTaxRate divided by 100 – this tax should be returnedfrom computeAnnualTax. • Write class EmpTest for testingthe Employee class • Create an employee object emp1bycalling constructorswith appropriate values(salary = 20000). • Create anotheremployee objectemp2having default salary (say 30000) • Create thi rd employee emp3having the valuessame as emp2. • Inputsalary from userand update the salary of emp2 to the newsalary (say 50000). • Compute Annual tax for all the employeesand displaythem in the test class. • Compare the salaries of each employee toshow the employee with the highest monthly salary. Upd ate the employee class so that it contains another instance variable called netMonthly Income, which is defined as monthly salary minus(-) monthly income tax. Add a method to the class Employee called computeNetSalary to compute it.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Function Arguments
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education