def new_month(self, month: int, year: int, bill: Bill) -> None: self.start = datetime.date(year, month, self.start.day) if self.balance > -10: bill.add_fixed_cost(-25) bill.add_fixed_cost(self.balance) self.balance = PREPAID_MINS_COST * bill.billed_min + bill.fixed_cost bill.set_rates("PREPAID", PREPAID_MINS_COST) self.bill = bill
def new_month(self, month: int, year: int, bill: Bill) -> None: if self.start.month == month and self.start.year == year: bill.add_fixed_cost(TERM_MONTHLY_FEE + TERM_DEPOSIT) else: bill.add_fixed_cost(TERM_MONTHLY_FEE) self.start = datetime.date(year, month, self.start.day) bill.set_rates("TERM", TERM_MINS_COST) self.bill = bill
def new_month(self, month: int, year: int, bill: Bill) -> None: """ Advance to a new month in the contract, corresponding to <month> and <year>. This may be the first month of the contract. per minute and fixed cost. Store the <bill> argument in this contract and set the appropriate rate """ bill.add_fixed_cost(MTM_MONTHLY_FEE) bill.set_rates("MTM", MTM_MINS_COST) self.bill = bill
def new_month(self, month: int, year: int, bill: Bill) -> None: """ Advance to a new month in the contract, corresponding to <month> and <year>. This may be the first month of the contract. Store the <bill> argument in this contract and set the appropriate rate per minute and fixed cost. """ # didnt use month year parameters # why MTM mins_cost is less than cost of term_mins.handout says oppsite. bill.set_rates("MTM", MTM_MINS_COST) bill.add_fixed_cost(MTM_MONTHLY_FEE) self.bill = bill
def new_month(self, month: int, year: int, bill: Bill) -> None: """ Advance to a new month in the contract, corresponding to <month> and <year>. This may be the first month of the contract. Store the <bill> argument in this contract and set the appropriate rate per minute and fixed cost. """ if self.balance > -10.00: self.balance -= 25 self.bill = bill bill.set_rates('Prepaid', PREPAID_MINS_COST) bill.add_fixed_cost(self.balance)
def new_month(self, month: int, year: int, bill: Bill) -> None: """ Advance to a new month in the contract, corresponding to <month> and <year>. This may be the first month of the contract. per minute and fixed cost. Store the <bill> argument in this contract and set the appropriate rate """ if self.start.month == month and self.start.year == year: bill.add_fixed_cost(TERM_DEPOSIT) self._current = [month, year] bill.add_fixed_cost(TERM_MONTHLY_FEE) bill.set_rates("TERM", TERM_MINS_COST) bill.add_free_minutes(TERM_MINS) self.bill = bill
def new_month(self, month: int, year: int, bill: Bill) -> None: """ Advance to a new month in the contract, corresponding to <month> and <year>. This may be the first month of the contract. Store the <bill> argument in this contract and set the appropriate rate per minute and fixed cost. """ bill.set_rates('TERM', TERM_MINS_COST) bill.add_fixed_cost(TERM_MONTHLY_FEE) if month == self.start.month and year == self.start.year: bill.add_fixed_cost(TERM_DEPOSIT) self._curr = datetime.date(year, month, 1) self.bill = bill
def new_month(self, month: int, year: int, bill: Bill) -> None: """ Advance to a new month in the contract, corresponding to <month> and <year>. This may be the first month of the contract. Store the <bill> argument in this contract and set the appropriate rate per minute and fixed cost. """ # initialising the <bill> argument. # term deposit is only added if it is the first month of the contract. # figure out how to access this bills attribute from phoneline. # if (month, year) in self.curr_month = month self.curr_year = year if self.bill is None: bill.add_fixed_cost(TERM_DEPOSIT) bill.set_rates("TERM", TERM_MINS_COST) self.bill = bill
def new_month(self, month: int, year: int, bill: Bill) -> None: """ Advance to a new month in the contract, corresponding to <month> and <year>. This may be the first month of the contract. Store the <bill> argument in this contract and set the appropriate rate per minute and fixed cost. """ bill.set_rates('PREPAID', PREPAID_MINS_COST) try: self._balance = self.bill.get_cost() except AttributeError: pass while self._balance > -10: self._balance -= 25 bill.add_fixed_cost(self._balance) self.bill = bill
def new_month(self, month: int, year: int, bill: Bill) -> None: """ Advance to a new month in the contract, corresponding to <month> and <year>. This may be the first month of the contract. Store the <bill> argument in this contract and set the appropriate rate per minute and fixed cost. """ # month year parameters no need. # cancel_contract and bill call are same a superclass contract. bill.set_rates("PREPAID", PREPAID_MINS_COST) if self.bill is None: bill.add_fixed_cost(-self.balance) if self.balance > -10.0: bill.add_fixed_cost(25.0) self.balance -= 25.0 self.bill = bill
def new_month(self, month: int, year: int, bill: Bill) -> None: """ Advance to a new month in the contract, corresponding to <month> and <year>. This may be the first month of the contract. Store the <bill> argument in this contract and set the appropriate rate per minute and fixed cost. """ self.year = year self.month = month if self.start is not None: self.count += 1 if self.count == 1: bill.add_fixed_cost(self.balance) else: if self.balance > -10: self.balance -= 25 bill.add_fixed_cost(self.balance) self.balance = bill.get_summary()['total'] bill.set_rates("PREPAID", PREPAID_MINS_COST) self.bill = bill
def new_month(self, month: int, year: int, bill: Bill) -> None: """ Advance to a new month in the contract, corresponding to <month> and <year>. This may be the first month of the contract. Store the <bill> argument in this contract and set the appropriate rate per minute and fixed cost. """ if month == int(self.cur_month) and year == int(self.cur_year): self.bill = bill bill.set_rates('PREPAID', PREPAID_MINS_COST) bill.add_fixed_cost(self.balance) else: self.cur_month = month self.cur_year = year self.bill = bill self.bill.set_rates('PREPAID', PREPAID_MINS_COST) self.bill.add_fixed_cost(self.balance) if self.balance > 0: self.balance -= 25 + self.balance else: if self.balance >= -10: self.balance -= 25
def new_month(self, month: int, year: int, bill: Bill) -> None: self.start = datetime.date(year, month, self.start.day) bill.set_rates("MTM", MTM_MINS_COST) bill.add_fixed_cost(MTM_MONTHLY_FEE) self.bill = bill