Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is Java and please make simple program and put // (comment) when you do any action, Thank you. Computing Taxes program. This is the

This is Java and please make simple program and put // (comment) when you do any action, Thank you.

Computing Taxes program. This is the problem 5.2 on page 228 of your text.

a. Create a class named TaxCalculator

b. Do not create instance variables or a constructor.

c. Create a method named calculateTax and it should return a double. It should have two arguments. One argument will be String named maritalStatus. The other argument should be a double named taxableIncome.

d. You will need nested if statements. The outside test should be whether maritalStatus is equal to married. Remember this is a String and you should use String comparison. An example of the if else statement is on page 200. An example of the String comparison is on page 186 and you need to use the .equals. Inside the comparison you need another set of if statements for the levels of taxableIncome. You will need to use a compound if statement to compare the various income levels. See top of page 212. Return the income tax due as a double.

e. Create a TaxCalculatorTester

f. Import Scanner

g. Create a Scanner object

h. Prompt the user for their marital status and assign it to a String.

i. Prompt the user for their income and assign it to a double.

j. Create an object of type TaxCalculator;

k. Create a taxDue double variable

l. Call the calculateTax method and assign the output to taxDue.

m. Print the martial status with appropriate words Marital Status is: XXX

n. Print the income with appropriate words.

o. Print the totalIncome with appropriate words.

image text in transcribedimage text in transcribedimage text in transcribed

228 Chapter 5 Decision:s P5.2 Write a program that computes taxes for the following schedule. If your status is Single and if the taxable income is over $0 $8,000 $32,000 If your status is Married and but not over $8,000 $32,000 the tax is 10% $800+ 15% $4,400 + 25% of the amount over S0 $8,000 $32,000 if the taxable income is over $0 $16,000 $64,000 but not over $16,000 $64,000 the tax is 10% $1,600 + 15% $8,800 + 25% of the amount over S0 $16,000 $64,000

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

Students also viewed these Databases questions