5 views

Uploaded by ZhichaoWang

j

j

© All Rights Reserved

- 262585680 Abe Cofnas Sentiment Indicators Renko Price Break Kagi Point and Figure 2010 292 Pages.85
- 262585680 Abe Cofnas Sentiment Indicators Renko Price Break Kagi Point and Figure 2010 292 Pages.1
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..131
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..166
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..121
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..233
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..200
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..257
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..312
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..11
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..302
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..189
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..149
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..58
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..192
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..270
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..310
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..311
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..315
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..181

You are on page 1of 1

outstanding at the start of each month, the amount of money to be paid each

month (initialized using the value returned by the function findPayment), and a

description of the mortgage (which initially has a value of None). The __init__

operation of each subclass of Mortgage is expected to start by calling

Mortgage.__init__, and then to initialize self.legend to an appropriate

description of that subclass.

The method makePayment is used to record mortgage payments. Part of each

payment covers the amount of interest due on the outstanding loan balance,

and the remainder of the payment is used to reduce the loan balance. That is

why makePayment updates both self.paid and self.owed.

The method getTotalPaid uses the built-in Python function sum, which returns

the sum of a sequence of numbers. If the sequence contains a non-number, an

exception is raised.

Figure 8.9 contains classes implementing two types of mortgage. Each of these

classes overrides __init__ and inherits the other three methods from Mortgage.

class Fixed(Mortgage):

def __init__(self, loan, r, months):

Mortgage.__init__(self, loan, r, months)

self.legend = 'Fixed, ' + str(r*100) + '%'

class FixedWithPts(Mortgage):

def __init__(self, loan, r, months, pts):

Mortgage.__init__(self, loan, r, months)

self.pts = pts

self.paid = [loan*(pts/100.0)]

self.legend = 'Fixed, ' + str(r*100) + '%, '\

+ str(pts) + ' points'

Figure 8.10 contains a third subclass of Mortgage. The class TwoRate treats the

mortgage as the concatenation of two loans, each at a different interest rate.

(Since self.paid is initialized with a 0.0, it contains one more element than the

number of payments that have been made. Thats why makePayment compares

len(self.paid) to self.teaserMonths + 1.).

- 262585680 Abe Cofnas Sentiment Indicators Renko Price Break Kagi Point and Figure 2010 292 Pages.85Uploaded byZhichaoWang
- 262585680 Abe Cofnas Sentiment Indicators Renko Price Break Kagi Point and Figure 2010 292 Pages.1Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..131Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..166Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..121Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..233Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..200Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..257Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..312Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..11Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..302Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..189Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..149Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..58Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..192Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..270Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..310Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..311Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..315Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..181Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..162Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..123Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..223Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..293Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..160Uploaded byZhichaoWang
- Introduction to Computation and Programming Using Python%2C Revised - Guttag%2C John v..126Uploaded byZhichaoWang