Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 4 (13 points): Purpose: Solve a problem by writing multiple functions that perform different subtasks, and combining their use to solve a larger problem,
Question 4 (13 points): Purpose: Solve a problem by writing multiple functions that perform different subtasks, and combining their use to solve a larger problem, also to practice documenting functions. Degree of Difficulty: Moderate Siblings John and Jane want to buy their first dog, sadly. COVID has made selling lemonade difficult. Fortu- nately, both John and Jane are excellent Fortnite players, and have started charging other players to carry them to victory. However, they weren't sure about what their hourly rate of pay was. Your task is to write a Python program that calculates and displays the hourly pay rate for the youths after taking their effort into consideration. To accomplish this, you will need to write three Python functions: time, revenue, and rate_of_pay. The time function should take parameters n_games (the number of games played), time_per_game (average length of a game in minutes), and return the total time spent playing Fortnite. The total time is: total_time = number of games x time per game. The revenue function should take parameters tips (the amount of money donated by grateful players). r_players (the number of players escorted), price_per_player (the selling price for carrying one player) and return the total amount of money earned. The total money earned is: total_revenue = tips + money earned from players escorted The rate_of_pay function determines the net profit (net money earned) by the youth. It should: . call time and revenue and use their return values to compute the rate of pay earned by the siblings: return the rate of pay for each sibling in dollars per hour. The parameters of the rate_of_pay function should be chosen so that they provide the necessary infor- mation required to call the cost and revenue functions. The rate of pay is: rate of pay = total_revenue total_time You must now test your program by preparing three examples of number of players escorted, price per player, number of games, average game length and tips in advance so that you can judge whether your program is correct Write code to ask the user for all five of these inputs, then display the cost, revenue, and pay rate of each prepared example to the console. Copy the console output from each of your three testing example into a text file and hand that text file in (see "What to Hand In' below). You may assume that the user supplies valid input from the console, that is, a positive number for all the parameters. See the sample run on the next page
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started