Link to home
Start Free TrialLog in
Avatar of Jnaneshwar
Jnaneshwar

asked on

SALES TAX Java problem solution??

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

Problem statement :

Basic sales tax is applicable at a rate of 10% on all goods, except books,
food, and medical products that are exempt. Import duty is an additional
sales tax applicable on all imported goods at a rate of 5%, with no
exemptions.

When I purchase items I receive a receipt which lists the name of all the
items and their price (including tax), finishing with the total cost of the
items, and the total amounts of sales taxes paid.  The rounding rules for
sales tax are that for a tax rate of n%, a shelf price of p contains
(np/100 rounded up to the nearest 0.05) amount of sales tax.

Write an application that prints out the receipt details for these shopping
baskets...
INPUT:

Input 1:
1 book at 12.49
1 music CD at 14.99
1 chocolate bar at 0.85

Input 2:
1 imported box of chocolates at 10.00
1 imported bottle of perfume at 47.50

Input 3:
1 imported bottle of perfume at 27.99
1 bottle of perfume at 18.99
1 packet of headache pills at 9.75
1 box of imported chocolates at 11.25

OUTPUT

Output 1:
1 book : 12.49
1 music CD: 16.49
1 chocolate bar: 0.85
Sales Taxes: 1.50
Total: 29.83

Output 2:
1 imported box of chocolates: 10.50
1 imported bottle of perfume: 54.65
Sales Taxes: 7.65
Total: 65.15

Output 3:
1 imported bottle of perfume: 32.19
1 bottle of perfume: 20.89
1 packet of headache pills: 9.75
1 imported box of chocolates: 11.85
Sales Taxes: 6.70
Total: 74.68
Avatar of Kevin Cross
Kevin Cross
Flag of United States of America image

Please post the code you have developed so far and specifics on compilation/runtime errors you are getting and/or questions as to why something is not working as expected and will gladly take a look.
ASKER CERTIFIED SOLUTION
Avatar of bluebelldiscovery
bluebelldiscovery
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@bluebelldiscovery, this is a homework assignment and it is the policy of EE not to just post the final solution in those cases.  We can help the asker learn the topic and guide him/her to final answer yes, but simply posting code is discouraged.  BTW, I could have done that yesterday. :) Hence my request to Jnaneshwar.  Anyway, not too big a deal, but just thought you should be aware of that in case you were not already.
Hi mwvisa1,
  You are definitely more qualified than me. Given the certification that you earned over the year.
Cheer.
Hope you don't mind, bluebelldiscovery, but I just sent you an e-mail.  Figured we don't need to fill question with my off-topic conversation. ;)

Cheers.
Guess your e-mail is not working, so drop me a line when you get a chance (see my profile).
Avatar of Jnaneshwar
Jnaneshwar

ASKER

Thanks so much for the soluton bluebelldiscovery, appreciate the quick solution .. yes I have noted the pointers provided by mwvisa1 as well regarding the workings of EE homework assignments, thanks for the same sir.

Regards
Jnaneshwar
Not a big deal.  That is why you got the answer you did from sciuriware.  Anyway, glad you got solution to your issue. :)
Actually the above code was not giving the right output ....i am attaching a code which is giving the expected output....Kindly check if its fine....i have uploaded the files in .txt format kindly convert it into .java and then u can run it ....check with the package structure also
PriceCalculator.txt
PurchasedItemsDO.txt
TaxCalucator.txt
sunsim24 Did you limit the quantity of item to 1? I am not able to run it with 2 as qty. Please help