Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

HELP FINISHING A FUNCTION IN PYTHON the actual problem is below: Write a computer program in Python, C, another language you know, or with Excel

HELP FINISHING A FUNCTION IN PYTHON

the actual problem is below:

Write a computer program in Python, C, another language you know, or with Excel to solve the general version of the parking space problem, described below. Your program should take as input the mean time it takes to shop, the mean inter-arrival time (or the average rate) of potential customers, the mean sales profit gained from a shopper, the monthly cost per parking space, and the amount of time per month the store is open. Your program output should be the expected net profit per month and the expected fraction of potential customers who shop, for k = 1, 2, . . . , n parking spaces, as well as an echo of the input data. Your program chooses an appropriate value of n, which had better depend on the input data. Besides providing numerical output, display your results visually in a way that would be helpful to the store manager. Put yourself in the managers shoes as you design your visual displays.

A store pays a monthly fee for each of its parking spaces. Potential customers arrive at the storefront as a Poisson Process with a known rate. If there is an empty parking space when a customer arrives, the customer parks, shops, and drives away. If all parking spaces are occupied, the customer leaves without shopping. Shoppers take an exponentially distributed amount of time with known mean. The average store profit per shopper (not counting the cost of parking spaces) is known. The store manager needs to decide how many parking spaces to pay for. The net profit in a month is the total store profit from shoppers minus the parking space fees.

Submit a copy of your code and the output from some representative sets of runs. For example, one of your sets could vary the cost per parking space while keeping the other data fixed, another could vary the shopping time while keeping the other data fixed, etc. Also, answer the following questions. You should think of at least two valid answers to each question.

HERE IS THE CODE I HAVE WRITTEN SO FAR:

image text in transcribed

? import leigh-extra-credit-problem.py-/Users/leighpurinton/Downloads/leigh-extra-credit-problem.?? (3.6.2) math # input average rate in arrivals/hour # input mean time of shopping in hours # input time per month shop is open in hours def monthlyProfit(meanTime, avgRate, meanProfit, costPerSpace, timePerMonth): # return (expected net profit, fraction of customers who do not balk) parkingCost ['Parking cost for i spaces ' index 'Number of parking spaces'] fractionofCustomers C'Expected fraction of customers who shop '] expectedNetProfit C'Expected net profit per month'] n = avgRate + meanTime + 3*(1/avgRate) # Added 3"(1/avgRate) (-3*(1/lambda) -3*std deviation) to pad against variance totalProfitableTime timePerMonth/(1/avgRate meanTime) for i in range(1,math.ceil(n)+1): parkingCost.append(i*costPerSpace) fractionofCustomers.append(fractionOfCustomers(i, avgRate)) expectedNetProfit.append(fractionofCustomers [i]*meanProfit) index.append(i) for j in range(math.ceil(n)+1): print(str(index[j]) + \tstr(fractionofCustomers [j]) +tt' $' str(expectedNetProfit[j])) def fractionOfCustomers(parkingSpaces, avgRate): # return probability of

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions