Question: Activity 5 : Write a program to calculate trip costs of an employee. The trip cost includes costs of the following: a ) Flight round

Activity 5: Write a program to calculate trip costs of an employee. The trip cost includes costs of the following:
a) Flight round trip cost
b) Hotel cost for x number of days
c) Car rental cost
Steps:
Use functions to calculate your trip's costs:
Define a function called hotel_cost with one argument nights as input. The hotel costs $140 per night. So, the function hotel_cost should return 140* nights.
Define a function called plane_ride_cost that takes a string, city, as input. The function should return a different price depending on the location, similar to the code example above. Below are some valid destinations and their corresponding round-trip prices.
"Napier": 150
"Auckland": 220
"Christchurch": 250
"Dunedin": 475
Define a function called rental_car_cost with an argument called days. Calculate the cost of renting the car: Every day you rent the car costs $40.(cost=40*days) if you rent the car for 7 or more days, you get $50 off your total(cost-=50).
Alternatively (elif), if you rent the car for 3 or more days, you get $20 off your total.
You cannot get both of the above discounts. Return that cost.
Finally define a function called trip_cost that takes two arguments, city and days. Like the example above, have your function return the sum of calling the rental_car_cost(days), hotel_cost(days), and plane_ride_cost(city) functions.
Modify your trip_cost function definition. Add a third argument, spending_money. Modify what the trip_cost function does. Add the variable `spending_money to the sum that it returns.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!