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 the python and explain. Also please show python. Suppose that a cashier owes a...
Please use the python and explain. Also please show python. Suppose that a cashier owes a customer some change and that the cashier only has quarters, dimes, nickels, and pennies. Write a program the computes the minimum number of coins that the cashier can return. To solve this problem use the greedy algorithm explained below. PROBLEM STATEMENT: Your program should first ask the user for the amount of money he/she is owed (in dollars). You may assume that the user...
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...
Prime cost worksheet (figure %, cost & sales to two decimal places) Open and use the...
Prime cost worksheet (figure %, cost & sales to two decimal places) Open and use the following chart below for the “prime cost” quiz. 10 questions for boxes A - J Cost of sales + cost of Labor = Prime cost Prime cost – cost of labor = cost of sales Prime cost – cost of sales = cost of labor Prime cost ÷ sales = prime cost % Prime cost x PC% = Sales Sales X PC% = prime...
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 $...
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...
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...
** Round all answers to two decimal places. can you please show the work so i...
** Round all answers to two decimal places. can you please show the work so i can understand** Part I - Use CVP to Plan Profits Nottingham News Company has the rights to sell and deliver the city newspaper in a designated area in the country. A monthly subscription sells for $30.00 and Nottingham News pays $10.00 per month for each newspaper subscription. In addition to this variable cost, Nottingham News has fixed costs of $3,000 per month. Nottingham News...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT