Write an algorithm to print the bill depending upon the price and quantity of an item. Also
print bill GST, which is the bill after adding 5% of tax in the total bill.
Answers
Answer:
GST ( Goods and Services Tax ) which is included in netprice of product for get GST % first need to calculate GST Amount by subtract original cost from Netprice and then apply
GST % formula = (GST_Amount*100) / original_cost
Netprice = original_cost + GST_Amount
GST_Amount = Netprice – original_cost
GST_Percentage = (GST_Amount * 100)/ original_cost
// CPP Program to compute GST from original
// and net prices.
#include <iostream>
using namespace std;
float Calculate_GST(float org_cost, float N_price)
{
// return value after calculate GST%
return (((N_price - org_cost) * 100) / org_cost);
}
// Driver program to test above functions
int main()
{
float org_cost = 100;
float N_price = 120;
cout << "GST = "
<< Calculate_GST(org_cost, N_price)
<< " % ";
return 0;
}
Output:
GST = 20%
Explanation:
GetTotalBill(food):
total=0
for item in food:
total=total+int(food[item])
return total
done=False
food={}
while done!=True:
foodname=input('Enter the food item name:')
price=input('Enter the food price:')
food[foodname]=price
userinput=input('Want to add one more item ? If Yes type Y & N for No:')
if userinput.upper()=='N':
done=True
total_bill=GetTotalBill(food)
tax=total_bill*5/100
final_bill=total_bill+tax
print(str(final_bill))
Hope You Understood The Answer
Explanation:
// CPP Program to compute GST from original
// and net prices.
#include <iostream>
using namespace std;
float Calculate_GST(float org_cost, float N_price)
{
// return value after calculate GST%
return (((N_price - org_cost) * 100) / org_cost);
}
// Driver program to test above functions
int main()
{
float org_cost = 100;
float N_price = 120;
cout << "GST = "
<< Calculate_GST(org_cost, N_price)
<< " % ";
return 0;
}