Assignment - Arrays - Road Trip You are going on a road trip with some friends. Make
Question:
Assignment - Arrays - Road Trip
You are going on a road trip with some friends.
Make a Python program to collect all the data of the trip and calculate each person share of the cost.
Prompt the user for the following:
- The number of days of the trip.
- The number of people on the trip.
- For each day of the trip:
- Cost of food.
- Cost of gas.
- NOTE: The prompts for cost of food and gas are for the entire group per day
Validate the all input (must be non-negative (i.e >= 0) You should be using a loop to validate. Be careful of you loop counter for the day loop.
The food and gas costs should be collected and stored in two separate arrays.
Display all data collected in the arrays. Optional: Display all data in tabular column form.
Calculate and display each of the following:
- The total cost of each category(food, gas).
- The total cost of the trip.
- Each person's share of the total cost.
Your program must have at least three Functions where data is passed through arguments and returns.
No Globals.
- One function to collect the costs array data
- One function to display the costs array data
- One or two functions to calculate and display the totals
Display your name,class,date as per SubmissionRequirements by using a function.
Your program should include Header comments (what the program does) and in-line comments (the major design steps).
I'm not sure how to lay out this assignment and write the code for it. This week we have learned more about arrays and loops so we still are using beginner Python coding in CMIS 102.
Introduction to Probability
ISBN: 978-0716771098
1st edition
Authors: Mark Daniel Ward, Ellen Gundlach