Question: need fixed in pytyon code: import math class ticket: _ _ ticketType: str _ _ baseCost: float _ _ discountAmount: float _ _ geniePlusCharges: float

need fixed in pytyon code:
import math
class ticket:
__ticketType: str
__baseCost: float
__discountAmount: float
__geniePlusCharges: float
__totalCost: float
def __init__(self, name, basecst):
self.__ticketType = name
self.__baseCost = basecst
self.__calc_discount()
self.__calc_genie_plus_charges()
self.__total_ticket_cost()
def calc_discount(self):
YesNo = input("Is guest udner ten years old or a veteran of the U.S. Armed Forces?: ")
if (YesNo)=='y':
self.__discountAmount =.15* baseCost
else:
self.__discountAmount =0
def calc_genie_plus_charge(self):
YesNo = input("Would you like to add Genis Plus to your ticket for $20.00?")
if (YesNo)=='y':
self.__geniePlusCharges =20+ self.__tickettype
else:
self.__geniePlusCharges =0
def calc_total_ticket_cost(self):
self.__totalTicketCost = self.__baseCost - self.__discountAmount + self.__geniePlusCharges
def print_ticket(self):
print(f"{self.__ticketType:<30}{self.__baseCost:>10.2f}{-self.__discountAmount:>10.2f}{self.__geniePlusCharges:>10.2f}{self.__totalTicketCost:>15.2f}")
@property
def ticketType(self):
return self.__ticketType
@property
def baseCost(self):
return self.__baseCost
@property
def discountAmount(self):
return self.__discountAmount
@property
def geniePlusCharges(self):
return self.__geniePlusCharges
@property
def totalCost(self):
return self.__totalCost
tickets =[]
def main():
another ="y"
while another.lower()=="y":
print("Welcome to Disnyland!")
print("Please select your ticket type:")
print("1)1-Day Single Park Ticket: $125.00")
print("2)1-Day Hopper Ticket: $185.00")
print("3)2-Day Single Park per Day Ticket: $225.00")
print("4)2-Day Hopper Ticket: $260.00")
selection = int(input("Your selection =======>"))
if selection ==1:
name ="1-Day Single Park Ticket"
basecst =125.00
elif selection ==2:
name ="1-Day Hopper Ticket"
basecst =185.00
elif selection ==3:
name ="2-Day Single Park Ticket"
basecst =225.00
elif selection ==4:
name ="2-Day Hopper Ticket"
basecst =260.00
tickets.append(ticket(name, basecst))
another = input("Add another ticket to your order? (y/n): ")
print("
YOUR ORDER:
")
print("{:<20}{:>10}{:>10}{:>10}{:>10}".format("BASE COST", "DISCOUNT", "GENIE+", "TOTAL COST"))
print("------------------------------------------------------------")
grandTotal =0
for o in tickets:
o.print_ticketType()
grandTotal = grandTotal + o.totalCost
print(f"
Your order total: ${grandTotal:.2f}")
print("
Enjoy your stay at Disneyland, the happiest palce on earth!")
if __name__=="__main__":
main()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!