Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

To distinguish between the different parts of functions and function calls. Below is a program that uses a function to compute the cost of leaving

To distinguish between the different parts of functions and function calls.
Below is a program that uses a function to compute the cost of leaving dogs at Joeys Doggy Day Care.
There is a cost per dog that is charged daily.
1 def day_care_cost ( number_of_dogs , number_of_days , price_per_dog ):
2"""
3 Computes the total cost of a stay at Doggy Day Care
4
5 number_of_dogs : the number of dogs
6 number_of_days : duration of stay in days
7 price_per_dog : cost for a single dog in dollars
8
9 Returns : total cost of the stay
10"""
11 daily_dog_cost = number_of_dogs * price_per_dog
12 total_cost = daily_dog_cost * number_of_days
13 return total_cost
14
15 # compute the cost of a stay for 3 dogs
16 # staying 7 days at a rate of $49.50 per dog
17 first_stay = day_care_cost (3,7,49.50)
18
19 # compute the cost of a stay for 10 dogs
20 # staying 3 days at a rate of $19.75 per dog
21 second_stay = day_care_cost (10,3,19.75)
For each of the following terms, list ALL of them that you can find in this source code, along with their line
numbers. Submitting a screenshot where you have clearly identified these elements is also acceptable.
(a) Function definitions
(b) Function calls
(c) Function arguments
(d) Function parameters
(e) What is the scope of:
i. daily_dog_cost
ii. number_of_days
iii. first_stay
(f) What are the values referred to by first_stay and second_stay when the program ends?

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

Oracle Database Foundations Technology Fundamentals For IT Success

Authors: Bob Bryla

1st Edition

0782143725, 9780782143720

More Books

Students also viewed these Databases questions