Question: 2.2. Write a class called Ticket that has the following: A field cost for the price of the ticket and a string field time

2.2. Write a class called Ticket that has the following: A field

2.2. Write a class called Ticket that has the following: A field cost for the price of the ticket and a string field time for the start time of the event (assume times are in 24-hour format, like '18:35') . A constructor that sets those variables A_str_() method that returns a string of the form Ticket( , ), where and are replaced with the values of the cost and time fields. A method called is_evening_time() that returns True or False, depending on whether the time falls in the range from 18:00 to 23:59. A method called bulk_discount() that takes an integer n and returns the discount for buying n tickets. There should be a 10% discount for buying 5 to 9 tickets, and a 20% discount for buying 10 or more. Otherwise, there is no discount. Return these percentages as integers. Test the class by creating a Ticket item, printing it, calling the is_evening_time() method, and calling the bulk_discount() method.

Step by Step Solution

3.36 Rating (174 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

class Ticket def initself cost time selfcost cost selftime time def strself return Ticketcost0 time1... View full answer

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 Electrical Engineering Questions!