Athul, a supermarket employee, needs a program to calculate Goods and Services Tax (GST) deductions for customer purchases. The program should take a purchase code (A to F) and amount, apply the relevant GST rate, subtract it from the original amount, and print the result.
Question
Athul, a supermarket employee, needs a program to calculate Goods and Services Tax (GST) deductions for customer purchases. The program should take a purchase code (A to F) and amount, apply the relevant GST rate, subtract it from the original amount, and print the result.
Solution
Sure, here is a simple Python program that can be used to calculate the GST deductions for customer purchases based on the purchase code:
def calculate_gst(purchase_code, amount):
# Define GST rates for each purchase code
gst_rates = {
'A': 0.05, # 5%
'B': 0.12, # 12%
'C': 0.18, # 18%
'D': 0.28, # 28%
'E': 0.03, # 3%
'F': 0.08 # 8%
}
# Get the GST rate for the given purchase code
gst_rate = gst_rates.get(purchase_code.upper())
if gst_rate is None:
print("Invalid purchase code.")
return
# Calculate the GST amount
gst_amount = amount * gst_rate
# Subtract the GST amount from the original amount
result = amount - gst_amount
# Print the result
print("The amount after GST deduction is: ", result)
# Test the function
calculate_gst('A', 1000)
In this program, we first define the GST rates for each purchase code in a dictionary. Then, we get the GST rate for the given purchase code. If the purchase code is invalid, we print an error message and return. If the purchase code is valid, we calculate the GST amount by multiplying the amount by the GST rate. We then subtract the GST amount from the original amount to get the result. Finally, we print the result.
Similar Questions
Single File Programming QuestionProblem StatementAthul, a supermarket employee, needs a program to calculate Goods and Services Tax (GST) deductions for customer purchases. The program should take a purchase code (A to F) and amount, apply the relevant GST rate, subtract it from the original amount, and print the result. The user's total amount and product code are used to calculate the GST.For example, if the amount is 100.00 and the product code is 'C', 5% GST is applied, and the amount is calculated as 100.00 - (100.00*0.05) which is equal to 95.00.Input format :The first line of the input consists of a character representing the product code ('A', 'B', 'C', 'D', 'E', or 'F').The second line consists of a float value representing the total amount.Output format :If the code is valid ('A', 'B', 'C', 'D', 'E', or 'F'), the output displays a float value representing the amount after deducting GST, rounded off to two decimal places, after applying the appropriate GST deduction.If the code is invalid, it displays "Invalid choice".Refer to the sample output for the formatting specifications.Code constraints :In this scenario, the test cases fall under the following constraints:100.0 ≤ total amount ≤ 10000.0Sample test cases :Input 1 :C100.00Output 1 :95.00Input 2 :A2000.00Output 2 :2000.00Input 3 :W2300.67Output 3 :Invalid choiceInput 4 :B10000.00Output 4 :9800.00Input 5 :D1234.52Output 5 :1086.38Input 6 :E5678.00Output 6 :4655.96Input 7 :F9789.00Output 7 :7048.08Note :The program will be evaluated only after the “Submit Code” is clicked.Extra spaces and new line characters in the program output will result in the failure of the test case.
Supply of all goods and/or services is taxable under GST. Discuss the validity of the statement. 2.5 Marks
what is difference between gst and income tax
GST Introduction has improved the economy – Evaluate thestatement
retailer selling goods to a customer for $88 and remitting $8 GST to the government.
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.