Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can someone answer this for me? SalesTax.py 1 1n many areas, different goods are taxed at different rates. 2 #Areas may charge higher tax rates
Can someone answer this for me?
SalesTax.py 1 1n many areas, different goods are taxed at different rates. 2 #Areas may charge higher tax rates for items like alcohol , 3! #gasoline, and soda, and lower tax rates for items like 4 #grocery items, medicines, and clothes. 6.?rite a class called purchas edGood. The constructor for 7 PurchasedGood should have one positional parameter called 8 #price, which is the price of the good as a float. It should 9 #then have two keyword parameters in this order: 10.- category, which is the category the good falls into. 11 category should have a default value of "General" 12: #-tax,which is the sales tax rate. tax should have a 13 default value of 0.07 14 # 15 These three values should be stored in attributes called 16 price category andtax. 17 18 Then, add a method called calculate total. calculate total 19#should calculate the price plus the-price times the tax 20 Wrate, then round the result to 2 decimal places and return 21 #the result. Remember, you can round to two decimal places 22 Wusing round (total,2) 24 25#Add your class here ! 26 27 28 29 Below are some lines of code that wi1l test your object. 30 #You can change these lines to test your code in different 31 ways. 32 # 33 #If your code works correctly, this will originally run 34 Herror-free and print ignoring rounding errors) : 35 #5.0 36 General 37 #0.07 38 #5.35 39 #5.0 40 Grocery #0.03 Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started