Restaurant Bill Amount - Python Problem Solution

Restaurant Bill Amount

Python Problem Solution


Problem:

Write a Python program to find the bill amount to be paid by the customer while ordering food online from a restaurant. The bill amount includes the amount for the food ordered based on the quantity and delivery charges based on distance of delivery as mentioned below:

The Restaurant, home delivers the vegetarian combo costing Rs. 120 per plate and the non vegetarian Rs. 150 per plate. Infact the restaurant gets more for non-vegetarian combo than the vegetarian combo.

The Customer must specify the type of food, quantity(no. of paltes) required and the approximate distance in kms from the restaurant to the delivery point.

The below information must be use to check the validity of data provided by the customer:

  • Type of food must be "V" for vegetarian and "N" for non-Vegetarian
  • Distance in kms must be greater than 0.
  • Quantity ordered should be minimum 1.
Identify the cost of food and delivery charges based on the type of food and distance provided. Then the bill amount must be calculated as given below:
Bill amount = cost per plate*quantity ordered+Delivery Charges
Use the information provided in the table below to calculate the delivery charge. The bill amount should be returned as -1, if any of the inputs is invalid.

Note: Initialize type of food, quantity and distance in kms with different values and test your program.

          Distance in Kms            Delivery Charges in Rs per km        
For first 3 kms 0
For next 3 kms 3
For the Remaining 6




SOLUTION

SHARE If you find this useful, please share with your friends and Community.
CODE TOGETHER..GROW TOGETHER.
Newer Posts Newer Posts Older Posts Older Posts

More posts

Comments

Post a Comment

Sponsored Content