write a Java program to calculate the bill amount to be paid by a customer based on the list of gems and quantity purchased. Any purchase with a total bill amount above rs.30000 is entitled for 5% discount. If any gem required by the customer is not available in the store, then consider total bill amount to be -1
Answers
Answered by
0
Explanation:
gems_list = ["Emerald", "Ivory", "Jasper", "Ruby", "Garnet"]
price_list = [1760, 2119, 1599, 3920, 3999]
reqd_gems = ["Ivory", "Emerald", "Garnet"]
reqd_quantity = [3, 2, 5]
quantity_dict = dict(zip(reqd_gems, reqd_quantity))
price_dict = dict(zip(gems_list, price_list))
print("Item", "Quantity", "Unit_price", "Total_price")
for k, v in quantity_dict.items():
print(k, v, price_dict[k], price_dict[k] * v)
print("Grand_total", sum([price_dict[k] * v for k, v in quantity_dict.items()]))
Similar questions