Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need fixed.. import math class ticket: _ _ ticketType: str _ _ baseCost: float _ _ discountAmount: float _ _ geniePlusCharges: float _ _ totalTicketCost:

need fixed..
import math
class ticket:
__ticketType: str
__baseCost: float
__discountAmount: float
__geniePlusCharges: float
__totalTicketCost: float
def __init__(self, tix, basecst):
self.__ticketType = tix
self.__baseCost = basecst
self.calc_discount()
self.calc_genie_plus_charges()
self.calc_total_ticket_cost()
def calc_discount(self):
YesNo = input("Is guest under ten years old or a veteran of the U.S. Armed Forces?(y/n): ")
if (YesNo).lower =='y':
self.__discountAmount =.15* basecst
else:
self.__discountAmount =0
def calc_genie_plus_charges(self):
YesNo = input("Would you like to add Genis Plus to your ticket for $20.00?: ")
if (YesNo).lower =='y':
self.__geniePlusCharges =20
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.__genie_plus_charges:>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 __totalTicketCost(self):
return self.__totalTicketCost
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:
tix ="1-Day Single Park Ticket"
basecst =125.00
elif selection ==2:
tix ="1-Day Hopper Ticket"
basecst =185.00
elif selection ==3:
tix ="2-Day Single Park Ticket"
basecst =225.00
elif selection ==4:
tix ="2-Day Hopper Ticket"
basecst =260.00
tickets.append(ticket(tix, basecst))
another = input("Add another ticket to your order? (y/n): ")
print("
YOUR ORDER:
")
print("{:<20}{:>10}{:>10}{:>10}".format("BASE COST", "DISCOUNT", "GENIE+", "TOTAL COST"))
print("------------------------------------------------------------")
grandTotal =0
for o in tickets:
o.print_ticket()
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions