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, dinnerCost PerDay, hotelCostPer Night) that takes as input: distanceKM: the trip's distance in

image text in transcribedimage text in transcribed

1. Write a Python function, tripCostAndInfo(distanceKM, vehSpeedMPS, vehKPL, gasCostPerLiter, breakfastCost PerDay, lunchCostPerDay, dinnerCost PerDay, 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. 2. Write a Python function, compare VehiclesForTrip(distanceM, veh1Name, veh1 Speed MPH, veh1 MPG, veh2Name, veh2SpeedMPH, veh2MPG, gasCost PerGallon, breakfastCost PerDay, lunchCost PerDay, dinnerCost PerDay, hotelCostPer Night) that computes the cost and other information of a trip for two different vehicles, and then prints information about the cost along a recommendation of vehicle should be used to save money (note: if trip cost is the same for both vehicles, say something appropriate). The function's parameters are: distanceM: the trip's distance in miles (type: float) veh1 Name: a string representing the first vehicle (e.g. "Tesla") veh1 SpeedMPH: vehicle 1's speed in miles per hour (type: float) veh1 MPG: vehicle l's fuel efficiency in miles per gallon (type: float) veh2Name: a string representing the second vehicle (e.g. "BYD") veh2Speed MPH: vehicle 2's speed in miles per hour (type: float) veh2MPG: vehicle 2's fuel efficiency in miles per gallon (type: float) gasCostPerGallon: the price of one gallon 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) dinnerCost PerDay: cost of a day's dinner in dollars (type: float) hotelCostPerNight: cost of one night in a hotel in dollars (type: float) compare VehiclesForTrip must make two calls to Q1's tripCostAndInfo function. Note: before calling tripCostAndInfo you should convert units using good accurate conversion factors for miles/kilometers and gallons/liters. Write function testQ10 that makes at least five calls to tripCostAndInfo(...) with different arguments. Write function test020 that makes at least five calls to compare Vehicles For Trip(...) with different arguments. 1. Write a Python function, tripCostAndInfo(distanceKM, vehSpeedMPS, vehKPL, gasCostPerLiter, breakfastCost PerDay, lunchCostPerDay, dinnerCost PerDay, 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. 2. Write a Python function, compare VehiclesForTrip(distanceM, veh1Name, veh1 Speed MPH, veh1 MPG, veh2Name, veh2SpeedMPH, veh2MPG, gasCost PerGallon, breakfastCost PerDay, lunchCost PerDay, dinnerCost PerDay, hotelCostPer Night) that computes the cost and other information of a trip for two different vehicles, and then prints information about the cost along a recommendation of vehicle should be used to save money (note: if trip cost is the same for both vehicles, say something appropriate). The function's parameters are: distanceM: the trip's distance in miles (type: float) veh1 Name: a string representing the first vehicle (e.g. "Tesla") veh1 SpeedMPH: vehicle 1's speed in miles per hour (type: float) veh1 MPG: vehicle l's fuel efficiency in miles per gallon (type: float) veh2Name: a string representing the second vehicle (e.g. "BYD") veh2Speed MPH: vehicle 2's speed in miles per hour (type: float) veh2MPG: vehicle 2's fuel efficiency in miles per gallon (type: float) gasCostPerGallon: the price of one gallon 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) dinnerCost PerDay: cost of a day's dinner in dollars (type: float) hotelCostPerNight: cost of one night in a hotel in dollars (type: float) compare VehiclesForTrip must make two calls to Q1's tripCostAndInfo function. Note: before calling tripCostAndInfo you should convert units using good accurate conversion factors for miles/kilometers and gallons/liters. Write function testQ10 that makes at least five calls to tripCostAndInfo(...) with different arguments. Write function test020 that makes at least five calls to compare Vehicles For Trip(...) with different arguments

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

The World Wide Web And Databases International Workshop Webdb 98 Valencia Spain March 27 28 1998 Selected Papers Lncs 1590

Authors: Paolo Atzeni ,Alberto Mendelzon ,Giansalvatore Mecca

1st Edition

3540658904, 978-3540658900

More Books

Students also viewed these Databases questions

Question

b. What groups were most represented? Why do you think this is so?

Answered: 1 week ago

Question

3. Describe phases of minority identity development.

Answered: 1 week ago

Question

5. Identify and describe nine social and cultural identities.

Answered: 1 week ago