Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Write a Python function, tripCostAndInfo(distanceKM, vehSpeedMPS, vehKPL, gasCostPerLiter, breakfastCost PerDay, lunchCostPerDay, dinnerCostPerDay, hotelCostPer Night) that takes as input: distanceKM: the trip's distance in kilometers

image text in transcribed

1. Write a Python function, tripCostAndInfo(distanceKM, vehSpeedMPS, vehKPL, gasCostPerLiter, breakfastCost PerDay, lunchCostPerDay, dinnerCostPerDay, hotelCostPer Night) that takes as input: distanceKM: the trip's distance in kilometers (type: float) vehSpeedMPS: the vehicle's speed during the trip, in meters per second (type: float) vehKPL: the vehicle fuel efficiency in kilometers per liter (type: float) gasCostPerLiter: the price of one liter of gas in dollars (type: float) breakfastCost PerDay: cost of a day's breakfast in dollars (type: float) lunchCostPerDay: cost of a day's lunch in dollars (type: float) dinnerCostPerDay: cost of a day's dinner in dollars (type: float) hotelCostPerNight: cost of one night in a hotel in dollars (type: float) and returns five values: the total cost of the trip in dollars (type: float) the gas cost of the trip in dollars (type: float) the number of hotel nights required (type: int) the numbers of lunches required (type: int) the food cost of the trip in dollars (type: float) Presume that you can only drive 8 hours per day. So, if a trip requires 15.25 hours, it will require a one-night hotel stay at an additional cost (beyond gas and food costs) equal to hotelCost PerNight. Important notes on cost: No hotel is needed on the day a trip ends. If a trip requires 8.0 hours, it does not require a hotel stay. Similarly, a trip of 16.0 hours requires one night of hotel, not two. No breakfast is needed on the first day of a trip. No dinner is needed on the final day of a trip. Lunch is needed only on days with more than 4.0 hours of travel

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions