Computers and Technology
19.06.2022 02:05
283
498
5
Solved by an expert

Write a program that prompts users to pick either a seat or a price. Mark sold seats

Write a program that prompts users to pick either a seat or a price. Mark sold seats by changing the price to 0. Use overloaded methods to implement seat allocation: When a user specifies a seat (row, column), make sure it is available. When a user specifies a price, find any seat with that price. Write appropriate responses to the user if the seat is already taken, if their seat is available, or the seat number of the assigned seat if they just specified a price, etc. A theater seating chart is implemented as a two-dimensional array of ticket prices, like this:.
10 10 10 10 10 10 10 10 10 10
10 10 10 10 10 10 10 10 10 10
10 10 10 10 10 10 10 10 10 10
10 10 20 20 20 20 20 20 10 10
10 10 20 20 20 20 20 20 10 10
10 10 20 20 20 20 20 20 10 10
20 20 30 30 40 40 30 30 20 20
20 30 30 40 50 50 40 30 30 20
30 40 50 50 50 50 50 50 40 30
Show Answers
lolz55678
lolz55678
4,5(44 marks)

Answer is given in the attached document.

Explanation:

Explanation is given in the attached document.


Write a program that prompts users to pick either a seat or a price. Mark sold seats by changing the
zitlays
zitlays
4,9(71 marks)

see explaination

Explanation:

#Function receive list as a parameter & returns single value

def median(list):

#Checking for empty list

if len(list) == 0:

return 0

list.sort() #Arranging list of elements

midIndex = int(len(list) / 2) #Determining middle element

if len(list) % 2 == 1:

#return median when number of elements in list is odd

return list[midIndex]

else:

#return median when number of elements in list is even

return (list[midIndex] + list[midIndex - 1]) / 2

#This function will calculate the mean of given list of numbers

#Function receive list as a parameter & returns single value

def mean(list):

#Checking for empty list

if len(list) == 0:

return 0

total = 0

for number in list:

total += number

return total / len(list) #returns calculated mean

#This function will calculate the mode of given list of numbers

#Function receive list as a parameter & returns single value

def mode(list):

if len(list) == 0:

return 0

numberDictionary = {} #Creating dictionary

for digit in list:

number = numberDictionary.get(digit, None)

if number == None:

numberDictionary[digit] = 1

else:

numberDictionary[digit] = number + 1

#Getting the maximum value from list

maxValue = max(numberDictionary.values())

modeList = []

for key in numberDictionary:

#Determing elements which has the maximum value

if numberDictionary[key] == maxValue:

modeList.append(key) #adding elements into list whose value is maximum

return modeList #returns mode list

def main():

#Creating list

list = [3, 1, 7, 1, 4, 4, 10]

print("List:", list) #Printing list of elements

#Printing mode of given list by calling function & passed list as a parameter

print ("Mode: ", mode(list))

#Printing median of given list by calling function & passed list as a parameter

print ("Median :", median(list))

#Printing mean of given list by calling function & passed list as a parameter

print ("Mean: ", mean(list))

main()

Popular Questions about the subject: Computers and Technology

If your computer system is not working correctly, you can use...
Computers and Technology
12.12.2022 20:20
What is the main function of the cpu?...
Computers and Technology
27.02.2022 11:32
What feature sets macs apart from other operating systems? desktop...
Computers and Technology
13.05.2020 13:12
Adeleted file or folder is not permanently deleted from a computer...
Computers and Technology
30.05.2020 02:33
Each element in an array can be accessed by its element number,...
Computers and Technology
31.05.2020 15:36
Why is it important for software developers to study human-computer...
Computers and Technology
21.04.2023 17:44
You took a fantastic photograph that you want to use in the report...
Computers and Technology
08.12.2020 18:57
The ellipse (three dots) following find in a menu indicates that...
Computers and Technology
19.08.2022 18:54

New questions by subject

Sales less cost of goods sold is a. gross sales. b. net profit....
Business
02.03.2022 11:12
#
#
#
#
# #

We expand our knowledge with many expert answers