# Ticket selling in Cricket Stadium using Python | Assignment Expert

## Problem Statement:

There’s a ticket-selling booth at the cricket stadium from where visitors have to buy tickets and only then, do they get entry. The ticket fare for the concert is Rs. 500. The ticket counter keeps watch on the total amount collected and the number of people who visited the stadium.

Design a class for the ticket counter containing-

• Data members:
• Number of visitors
• Total amount collected
• Member Functions:
• To increment the number of visitors and the total amount.
• To display the total number of visitors and the total amount collected so far.
• Also, initialize the members.

## Code for Ticket selling in Cricket Stadium using Python:

``````class Counter:
#class variables to initialize the members
NoofVisitors = 0
TotalAmount = 0

#function for incrementing the visitors and tolling total amount
def sellticket(self):
#increment the number of visitors
Counter.NoofVisitors +=1
#add the ticket fair to the total amount
Counter.TotalAmount +=500

#function to display total number of visitors and amount collected
def display(self):
#display number of visitors
print("Total Number of Visitors: ", Counter.NoofVisitors)
#display total amount collected
print("Total Amount Collected: ",Counter.TotalAmount)

#test this class
C1 = Counter()
C1.sellticket()
C1.display()

C2 = Counter()
C2.sellticket()
C2.display()``````