Question: class PlanType: . def init _(self, basic_rate, default mins, rate_per min, has_rollover-True): create/initialize instance variables for all four non-self parameters. You can assume all arguments
class PlanType: . def init _(self, basic_rate, default mins, rate_per min, has_rollover-True): create/initialize instance variables for all four non-self parameters. You can assume all arguments are valid and there is no need to perform any checking def istr _(self): create/return a string as in this example: "PlanType (25.50, 20e, Je.se,True) . def repr _(self): create/return a string identical to the -_str_ outpurt. class PhonePlan: def-init_ (self, type, lines-None): create initialize instance variables for type andthe list of lines in the plan. When lines is not provided, use an empty list as its initial value. Creaie an variable calls to keep a list of calls made/received by any line of this plan, initialize it to be sa erunty list Also create instance variables for balance, rollover mins, and mins to_pay, all starting at 2 instance e def str_ (self): create/return a string similar to: "PhonePlan(PlanType(25.se,_1ee,..e.se,True),.n ,.n)" See test cases for more examples. Hint: when obtaining strings for the lists of lines/'calis, upon other str or repr definitions to make this a short/trivial method to write? . def _repr_(self): create/return a string identical to the str output. def activate_all(self): make sure every line in this plan is active after calling this method. def deactivate all(self): make sure every line in this plan is inactive after calling this method def add call(self, call): add the given call to the end of the list of calls. Either caller or callee of the given call should be a line of this plan, otherwise do not append but raise a PhonePlanError with error message "call cannot_be added". If call can be added, check whether the call is billable based on the following rules: o A local call is free and not billable: Hint: use your Call class's is local method to help o A call made between two lines of this plan is free and not billable For a billable call, increment instance variable mins_to_pay based on the length of the call. All updates made in this method change instance variables directly and the method returns None. def remove_call(self, cal1): remove the given call from the list of calls and returns None. If call is not present in the list, raise a PhoneplanErron with error message no such cal2 to renove
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
