Question

In: Computer Science

***PYTHON PLEASE*** I'd also like to use decimal to two places when calculating the money $$...

***PYTHON PLEASE***

I'd also like to use decimal to two places when calculating the money $$ values for budget and fee areas.

Thank you!

--------------------------------------------------------

Create a Park class. Include the following seven data members:

Name of Park

Location

Type of Park (National, State or Local)

Fee

Number of Employees

Number of visitors reported for the past 12 months

Annual Budget

Write your __init__ class

In addition write four separate instance methods that:

Return a string containing the name of the park, the location and type of park.

Computes the cost per visitor based on annual budget, and the number of visitors during the last 12 months.

Computes the revenue from fees for the past year based on number of visitors and fee.

Prints the values of all of the data members with appropriate labels.

Create a second class to test all aspects of your Park class.

Solutions

Expert Solution

##IF YOU ARE SATISFIED WITH THE CODE, KINDLY LEAVE A LIKE, ELSE COMMENT TO CLEAR DOUBTS

CODE:

class park:
def __init__(self,name,location,type_,fee,num_emp,num_visitors,annual_budget):
self.name = name
self.location = location
self.type_ = type_
self.fee = fee
self.num_emp = num_emp
self.num_visitors = num_visitors
self.annual_budget = annual_budget
def printNameLocationType(self):
string = "\nNAME ->\t" + self.name + "\nLOCATION ->\t" + self.location + "\nTYPE ->\t" + self.type_
return string
def getCostPerVisitor(self):
return self.annual_budget/self.num_visitors
def getRevenue(self):
return self.fee * self.num_visitors
def __str__(self):
string = self.printNameLocationType()
string += "\t\nFEE ->\t"+str(self.fee) + "\n\tNUMBER OF VISITORS ->\t" + str(self.num_visitors) + "\n\tCOST PER VISITOR ->\t{:.2f}".format(self.getCostPerVisitor())
string += "\n\tNUMBER OF EMPLOYEE ->\t"+str(self.num_emp) + "\n\tREVENUE ->\t\t"+str(self.getRevenue()) + "\n\tANNUAL BUDGET ->\t"+str(self.annual_budget)
return string

class driver: #another class to test the park class
def __init__(self):
pass
def run(self):
while(True):
name = input("\nEnter the name of the park: ")
location = input("\nEnter the location of the park: ")
while(True):
type_ = input("\nEnter the type of the park(National, State or Local): ")
if type_ not in ["National","State","Local"] :
print("Wrong type..... Enter again!")
continue
else:
break
while(True):
try:
fee = int(input("\nEnter the fee: "))
except:
print("Some error occured.....Enter again!")
continue
break
while(True):
try:
num_emp = int(input("\nEnter the number of employees: "))
except:
print("Some error occured.....Enter again!")
continue
break
while(True):
try:
num_visitors = int(input("\nEnter the number of visitors: "))
except:
print("Some error occured.....Enter again!")
continue
break
while(True):
try:
annual_budget = int(input("\nEnter the annual budget: "))
except:
print("Some error occured.....Enter again!")
continue
break
p = park(name,location,type_,fee,num_emp,num_visitors,annual_budget)
print(p)
print("\nDO YOU WANT TO CONTINUE? (Y FOR YES): ")
if input() not in ['Y','y']:
break
d = driver()
d.run()

CODE PREVIEW:


Related Solutions

Instructions: Where applicable, enter your answers to 2 decimal places. Also, use / for divide, *...
Instructions: Where applicable, enter your answers to 2 decimal places. Also, use / for divide, * for multiply, ( ) to put terms in parentheses, and ^ to raise to a certain power. Use $ for monetary terms but do not use a comma. Consider that a perfectly competitive, constant long-run cot industry with identical firms is currently in long run equilibrium. The market demand is described by the equation Q = 2020 - 2P and the total cost function...
Please use this description to calculate the values requested below (correct to 3 decimal places)... The...
Please use this description to calculate the values requested below (correct to 3 decimal places)... The athletic departments at 10 randomly selected U.S. universities were asked by the Equal Employment Opportunity Commission to state what percentage of their nursing scholarships were presently held by women. The responses were 5, 4, 2, 1, 1, 2, 10, 2, 3, 5. CV (hint: write this as a percentage without the % symbol, not a proportion) p-value for the Anderson-Darling normality test Upper outer...
Do it in python please! also please use this template please I have provided and below...
Do it in python please! also please use this template please I have provided and below is the activity def main(): # import the module random try: # asking the user to enter a number between 1 and 100 #loop time while if elif #for loop # generates that number of random integers and stores them in a list for x in # computations # displays the results on the screen # call try_Again to give the user the opportunity...
Calculate the sum of squares of experimental error. Please round your answer to two decimal places.
Consider the following table: SS DF MS F Among Treatments 1916.25       Error ? 12 263.24 Total   19 Step 1 of 8: Calculate the sum of squares of experimental error. Please round your answer to two decimal places. Step 2 of 8: Calculate the degrees of freedom among treatments. Step 3 of 8: Calculate the mean square among treatments. Please round your answer to two decimal places. Step 4 of 8: Calculate the F-value. Please round your answer to two decimal...
Use the Dynamic Exhibit to answer the following questions. Round your answers to two decimal places,...
Use the Dynamic Exhibit to answer the following questions. Round your answers to two decimal places, if necessary. 1. When the number of units produced is 50,000, the total fixed cost is $ 500,000 and the cost per unit is $ . 2. When the number of units produced is 100,000, the total fixed cost is $ and the cost per unit is $ . 3. When the number of units produced is 150,000, the total fixed cost is $...
This question contains three parts. Please show your numeric answers as percentages with two decimal places...
This question contains three parts. Please show your numeric answers as percentages with two decimal places (XX.XX%). a) Assume that at the end of 2008, the level of S&P 500 index was 980, the expected annual dividend yield on the index in 2009 was 2.1%, and the expected annual growth rate in dividends in the long term was 7.5%. The long-term U.S. government yearly bond yield at the end of 2008 was 1.9%. What was the implied annual market risk...
ROUND ALL CALCULATIONS TO TWO (2) DECIMAL PLACES a. (15 pts) Please draw the Keynesian Cross...
ROUND ALL CALCULATIONS TO TWO (2) DECIMAL PLACES a. (15 pts) Please draw the Keynesian Cross assuming the following information. Be sure to specify at what point consumption and disposable income are equal. Marginal Propensity to Consume = .88 Autonomous Consumption = $525 b. (5 pts) Assume that your disposable income is $760. How much are you consuming? Are you saving or dissaving? c. (10 pts) Assume that autonomous consumption increases to $890. Please illustrate this change on graph from...
Please show all work for full credit! When performing calculations, round numbers to 3 decimal places...
Please show all work for full credit! When performing calculations, round numbers to 3 decimal places The California Condor (Gymnogyps californianus) is a critically endangered species. In 1991, 48 adults individuals were released in the wild from the captive breeding program. In 2016, there were approximately 323 individuals in existence. 1.Calculate r for this time frame, assuming a continuous and constant growth rate (2 pts). 2.What is the doubling time of this population (2 pts)? 3. 30 rabbits are introduced...
Instructions: Round all your math steps to two decimal places just like I have been doing...
Instructions: Round all your math steps to two decimal places just like I have been doing in class. Consider the following hypothesis test: H0: µ ≤ 25 Ha: µ > 25 A sample of 40 provided a sample mean of 26.4. The population standard deviation is 6. a. Compute the value of the test statistic. (Round to two decimal places). Answer b. What is the p-value? (Round to four decimal places). Answer c. At α=0.01, what is your conclusion? Answer...
Please explain the solution to this problem to me conceptually as well as mathematically. I'd like...
Please explain the solution to this problem to me conceptually as well as mathematically. I'd like to fully understand the transactions and the logic behind them. Thank you. In year 1, Rim Corporation purchases 1,000 shares of treasury stock for $10 per share. In year 2, Rim reissues 100 shares of treasury stock for $12 per share. In year 3, Rim reissues 500 shares of its treasury stock for $9 per share. The journal entry to record the reissuance of...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT