Reference no: EM131055175
Python Programming
OOP - Classes
Write a program to calculate and display the loan for buying a car.
1. Create a class call Loan.
Data fields in the Loan class include:
1. Annual Interest Rate (Float)
2. Number of years of loan (Float)
3. Loan Amount (Float)
4. Borrower's Name (string)
2. Create the initializer or constructor for the class with the above data fields. Make the data fields private.
3. Create accessors (getter) for all the data fields.
4. Create mutators (setters) for all the data fields.
5. Create a class method- getMonthlyPayment where monthlyPayment = loanAmount * monthlyInterestRate / (1 - (1 / (1 + monthlyInterestRate) ** (numberOfYears * 12)))
note: that the monthly interest rate = annualinterest / 1200
6. Create a class method - getTotalPayment where totalPayment = getMonthlyPayment() * \ numberOfYears * 12
7. Write a test program (main function) to allow the user to enter the following:
1. Annual Interest Rate
2. Number of Years of Loan
3. Loan Amount
4. Borrower's Name
Allow the user to change the loan amount and reprint the new loan information.
The output should look like this:
>>>
Enter yearly interest rate, for example, 7.25: 2.5 Enter number of years as an integer: 5
Enter loan amount, for example, 120000.95: 1000.00 Enter a borrower's name: John Jones
The loan is for John Jones
The monthly payment is 17.75 The total payment is 1064.84
Do you want to change the loan amount? Y for yes or enter to quit y Enter new loan amount 5000
The loan is for John Jones
The monthly payment is 88.74 The total payment is 5324.21
>>>
The total value of the two securities
: Maritza has one share of stock and one bond. The total value of the two securities is 1,032 dollars. The bond has a YTM of 12.54 percent, a coupon rate of 11.28 percent, and a face value of 1,000 dollars; pays semi-annual coupons with the next one ex..
|
Sketch a block flow diagram of the process
: Cinnamic aldehyde ( a fragrance compound) can be made by base catalysed aldol condensation reaction between benzaldehyde and acetaldehyde.the feeds are contacted with sodium hydroxide in a stirred tank reactor.
|
Dividends related to the information asymmetry problem
: 1. How is Linear's decision to pay out dividends related to the information asymmetry problem 2. Should Linear return cash to shareholders? If so, how?
|
Question regarding the python programming
: Write a program to calculate and display the loan for buying a car. 1. Create a class call Loan. Data fields in the Loan class include: 1. Annual Interest Rate (Float) 2. Number of years of loan (Float)
|
Stocks pay annual dividends that are expected to continue
: Kwame owns one share of stock of Fairfax Paint and one share of stock of Litchfield Design. The total value of his holdings is 179 dollars. Both stocks pay annual dividends that are expected to continue forever. The expected return on Fairfax Paint s..
|
Stock portfolio with a total value
: Mrs. Landis has a 2-stock portfolio with a total value of $520,000. $175,000 is invested in Stock A with a beta of 1.25 and the remainder is invested in Stock B with a beta of 1.25. What is her portfolio's beta?
|
Calculates the sum of all the gaps between successive array
: calculates the sum of all the gaps between successive array elements. The array elements are double words, sequenced in nondecreasing order.
|
Present value of dividend expected to be paid in four years
: Common stock of Fairfax Paint is currently priced at 90.39 dollars per share. The stock is expected to pay annual dividends that are expected to grow by 4.26 percent forever. The next dividend is expected in 1 year and the expected annual return for ..
|