Avatar of Mirim Lee
Mirim Lee

asked on 

SALES TAX Java problem solution??

Can someone please let me know the solution to this problem ?

Problem statement :

The Michigan Legislature is trying to find a way to fund road repair. One of the options that was proposed (and rejected by the voters) was to raise the sales tax by one percent. One would assume that it is still possible that such as increase could still occur, if other funding sources are not found. Create a Java class named SalesTax that helps you figure out how the possible one percent increase in the Michigan sales tax will affect you. The program will read in your current yearly total income, and also read in the percent of that income you think is spent on items that get hit by the Michigan sales tax (just the sales tax - ignore federal income taxes, state income taxes, money spent on non-taxable purchases like food, etc.). Your program will then show you how much of your income is spent on taxable items, how much tax you currently pay on those expenditures (at 6%), how much you would pay at 7%, and finally the program will show the difference between the 6% and the 7% payments.

Your program should accept any reasonable values for income (zero to a couple of million), and any reasonable value for "pecent of income (0 to 100 percent). You don't need to do any error checking of the values -- just assume that the user will type in reasonable values.

You don't have format the monetary values so that they look as nicely formatted as what is shown in the sample output, since that output was generated with printf. For example, my program might show exactly two digits after the decimal point, and a comma every third digit before the decimal point, as might be shown in the first line of calculated output as:

            Taxable income: $7,805.31

In that line the monetary value is shown as "7,805.31", whereas the simple print and println methods we've used so far might print "7805.3125". This doesn't look as good as the "7,805.31" I generated with printf, but the "7805.3125" output you get with print and println is perfectly acceptable.
JavaMiscellaneous

Avatar of undefined
Last Comment
dpearson

8/22/2022 - Mon