Create a class named TaxCalculator with the following: A double data type variable named “annualIncome”. A double data type array containing the following values in this order: 0, .1, .15, .23, .28, .33, .35 A method which takes annual income as a parameter and prints the tax calculated as per the below tax bracket: Tax brackets: Tax Bracket 0 : Income <= 0 Tax Bracket 1 : 0 < income <= 9999 Tax Bracket 2 : 9999 < income <= 39999 Tax Bracket 3 : 39999 < income <= 89999 Tax Bracket 4 : 89999 < income <= 189999 Tax Bracket 5 : 189999 < income <= 399999 Tax Bracket 6 : 399999 < income Conditionally check 1 of the 8 different income brackets given above to find where the user’s income falls. Assume the array elements (from 1.b above) match with these income brackets sequentially (i.e, if your bracket is 0 < income <= 9999 then the tax rate is .1, which is the 2nd element in your array), calculate and print the amount of tax they will pay – where a users’ tax will is calculated as annual income * tax rate . For example, if annual income is $200,000, which falls in tax bracket 5, then tax rate would be .33 & therefore the tax paid would be $66,000... Ouch! 2. Create a. Make an object of TaxCalculator class. another class TaxCalculatorDemo. In that: b. Take annual income as input from the user and set to object’s annualIncome and print the total tax to be paid. c. Use try...catch block while taking the user’s annual income and if the user enters a “non-double” input (like string), then print “Invalid income entered”. d. Show output for valid and invalid user entry.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

(In Java language)

Create

a class named TaxCalculator with the following:

  1. A double data type variable named “annualIncome”.

  2. A double data type array containing the following values in this order:

    0, .1, .15, .23, .28, .33, .35

  3. A method which takes annual income as a parameter and prints the tax calculated as per the below tax bracket:

    1. Tax brackets:

      Tax Bracket 0 : Income <= 0
      Tax Bracket 1 : 0 < income <= 9999
      Tax Bracket 2 : 9999 < income <= 39999 Tax Bracket 3 : 39999 < income <= 89999 Tax Bracket 4 : 89999 < income <= 189999 Tax Bracket 5 : 189999 < income <= 399999 Tax Bracket 6 : 399999 < income

    2. Conditionally check 1 of the 8 different income brackets given above to find where the user’s income falls.

    3. Assume the array elements (from 1.b above) match with these income brackets sequentially (i.e, if your bracket is 0 < income <= 9999 then the tax rate is .1, which is the 2nd element in your array), calculate and print the amount of tax they will pay
      – where a users’ tax will is calculated as annual income * tax rate
      .

    4. For example, if annual income is $200,000, which falls in tax bracket 5, then tax rate would be .33 & therefore the tax paid would be $66,000... Ouch!

2. Create
a. Make an object of TaxCalculator class.

another class TaxCalculatorDemo. In that:
b. Take annual income as input from the user and set to object’s annualIncome and

print the total tax to be paid.
c. Use try...catch block while taking the user’s annual income and if the user enters a

“non-double” input (like string), then print “Invalid income entered”. d. Show output for valid and invalid user entry.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY