Question

In: Computer Science

Read chapter 3 from our text, Murach's Python Programming, focusing on coding the iteration structure (while...

Read chapter 3 from our text, Murach's Python Programming, focusing on coding the iteration structure (while statement). Then code Python statements for the pseudocode under a "Payment Schedule" shown below.
Save these Python statements in a text file named with your first name, last name, the digits 06, and extension .py (e.g. joelMurach06.py). To maximize points earned, first test this file with Python IDLE to ensure it is error free, then attach the python file to an email sent to [email protected].
Include our class code (csci233) and your leomail name in the "Subject" line of your email to [email protected] .

Payment Schedule (example output)

month  payment  interest  applied  balance
    1  50.00    2.00      48.00    352.00
    2  50.00    1.76      48.24    303.76
    3  50.00    1.52      48.48    255.28
...
    8  50.00    0.29      49.71      9.21
    9   9.26    0.05       9.21     0.00
Total 409.26   9.26     400.00

Pseudocode for a "Payment Schedule":
0. Code a comment that includes your first and last names and leomail address.
1. Have input/prompts to enter values for:
a purchase amount, a fixed monthly payment amount, and an annual interest rate. Example: a notepad purchase that is to cost $400.00, with $50 monthly payments, an annual interest rate of 6 percent(a whole number to be converted to decimal fraction) to be compounded monthly on the remaining principal balance.
2. Assign purchase amount to the beginning balance;
3. To represent a monthly interest rate in decimal terms, multiply the annual rate by 0.01 then divide by 12 (the months in a year);
4. while balance is greater than zero:
    a. compute the monthly interest charge on the balance;
    b. accumulate the interest charge for a final total on interest;
    c. reduce the balance due by the monthly payment minus the interest charge (or to zero if the regular monthly payment would exceed the outstanding balance);
    d. print the month number, payment, current month's interest charge, net amount applied to the balance, and the remaining balance after applying the payment (net after subtracting the interest).
     
5. Write a summary line with totals for the payment, interest and applied columns.

*Note that the last payment amount is likely to be different than the usual monthly payment.


(25 points for homework 6).

Solutions

Expert Solution

Short Summary:

  • Implemented the program as per given instruction

**************Please upvote the answer and appreciate our time.************

Source Code:

purchaseAmount = float(input("Enter purchase amount: "))
monthlyPayment = float(input("Enter fixed monthly payment amount: "))
APR = float(input("Enter annual interest rate: "))

#2. Assign purchase amount to the beginning balance;
beginingBalance = purchaseAmount

#3. To represent a monthly interest rate in decimal terms, multiply the annual rate by 0.01 then divide by 12 (the months in a year);
monthlyRate = (APR * 0.01) /12

totalInterest = 0
totalPayment = 0
month = 0

print("{0:<10} {1:<10} {2:<10} {3:<10} {4:<10}".format("Month", "Payment", "Interest", "Applied", "Balance"))

#4. while balance is greater than zero:
while beginingBalance > 0:
month += 1
# a. compute the monthly interest charge on the balance;
monthlyInterest = beginingBalance * monthlyRate
#b. accumulate the interest charge for a final total on interest;
totalInterest += monthlyInterest
#c. reduce the balance due by the monthly payment minus the interest charge
#(or to zero if the regular monthly payment would exceed the outstanding balance);
if monthlyPayment > beginingBalance:
monthlyPayment = beginingBalance + monthlyInterest
beginingBalance = beginingBalance - (monthlyPayment - monthlyInterest)
  
totalPayment += monthlyPayment
  
# d. print the month number, payment, current month's interest charge,
#net amount applied to the balance, and the remaining balance after applying the payment (net after subtracting the interest).
print("{0:<10} {1:<10.2f} {2:<10.2f} {3:<10.2f} {4:<10.2f}".format(month, monthlyPayment, monthlyInterest, monthlyPayment-monthlyInterest, beginingBalance))

#5. Write a summary line with totals for the payment, interest and applied columns.
print("{0:<10} {1:<10.2f} {2:<10.2f} {3:<10.2f}".format("Total", totalPayment, totalInterest, totalPayment-totalInterest))

Refer the following screenshots for code indentation:

Sample Run:

**************************************************************************************

Feel free to rate the answer and comment your questions, if you have any.

Please upvote the answer and appreciate our time.

Happy Studying!!!

**************************************************************************************


Related Solutions

Programming Activity 1(Python) Utilise a count-based iteration structure that will accepts the data listed below and...
Programming Activity 1(Python) Utilise a count-based iteration structure that will accepts the data listed below and produce the total purchase amount. Your final report should be similar to the one show below. Input Data: Item Description Item Price Salomon Fish $ 26.97 Ribeye Steak $ 12.98 Sweet Corn $ 4.96 Asparagus $5.92 Output: Item Description Item Price ================================= Salomon Fish $26.97 Ribeye Steak $ 12.98 Sweet Corn $ 4.96 Asparagus $ 5.92 Your total purchase: $ xx.xx
Read Chapter 36 from your Text Book and PP II. NCLEX Review Questions Chapter 36 from...
Read Chapter 36 from your Text Book and PP II. NCLEX Review Questions Chapter 36 from Evolve Resources III. Case Study: Mitral Stenosis Patient Profile L.S. is a 59-year-old female who goes to see her primary care provider because of increasing fatigue and shortness of breath with activity. She has a history of hypertension, hypothyroidism, rheumatoid arthritis, and rheumatic fever as a child. She is taking the following medications: Triamterene/hydrochlorothiazide 37.5/25 mg PO daily Levothyroxine 150 mcg PO daily Methotrexate...
Read Chapter 37 from your Text Book II. NCLEX Review Questions Chapter 37 from Evolve Resources...
Read Chapter 37 from your Text Book II. NCLEX Review Questions Chapter 37 from Evolve Resources III. Case Study:  Deep Vein Thrombosis Patient Profile D.R. is a 74-year-old obese Hispanic woman who is in the third postoperative day after an open reduction internal fixation (ORIF), for repair of a left femoral neck fracture after a fall at home. Subjective Data States pain in her left hip is a 4 to 5 on a 1-to-10 scale States pain in her left calf...
I. Read Chapter 37 from your Text Book II. NCLEX Review Questions Chapter 37 from Evolve...
I. Read Chapter 37 from your Text Book II. NCLEX Review Questions Chapter 37 from Evolve Resources III. Case Study:  Deep Vein Thrombosis Patient Profile D.R. is a 74-year-old obese Hispanic woman who is in the third postoperative day after an open reduction internal fixation (ORIF), for repair of a left femoral neck fracture after a fall at home. Subjective Data States pain in her left hip is a 4 to 5 on a 1-to-10 scale States pain in her left...
I. Read Chapter 36 from your Text Book and PP II. NCLEX Review Questions Chapter 36...
I. Read Chapter 36 from your Text Book and PP II. NCLEX Review Questions Chapter 36 from Evolve Resources III. Case Study: Mitral Stenosis Patient Profile L.S. is a 59-year-old female who goes to see her primary care provider because of increasing fatigue and shortness of breath with activity. She has a history of hypertension, hypothyroidism, rheumatoid arthritis, and rheumatic fever as a child. She is taking the following medications: Triamterene/hydrochlorothiazide 37.5/25 mg PO daily Levothyroxine 150 mcg PO daily...
I. Read Chapter 36 from your Text Book and PP II. NCLEX Review Questions Chapter 36...
I. Read Chapter 36 from your Text Book and PP II. NCLEX Review Questions Chapter 36 from Evolve Resources III. Case Study: Mitral Stenosis Patient Profile L.S. is a 59-year-old female who goes to see her primary care provider because of increasing fatigue and shortness of breath with activity. She has a history of hypertension, hypothyroidism, rheumatoid arthritis, and rheumatic fever as a child. She is taking the following medications: Triamterene/hydrochlorothiazide 37.5/25 mg PO daily Levothyroxine 150 mcg PO daily...
Read the lecture for Chapter 7, the following text and then answer the question at the...
Read the lecture for Chapter 7, the following text and then answer the question at the end. Notice the grading criteria this week is different than other weeks Constructors Constructor methods inside a class are methods that determine how an object is going to be created when some program instantiate one of them using the “new” clause. Their main use is to initialize the object’s instance variables. For example, last week I presented the Chair class that represented chairs. This...
C programming. Explain by taking a programming example how do while loop is different from while...
C programming. Explain by taking a programming example how do while loop is different from while loop?
Which of the cognitive biases that are discussed in Chapter 1 of our text do you...
Which of the cognitive biases that are discussed in Chapter 1 of our text do you think you might be most subject to? Why? What are some other psychological tendencies that you have that might interfere with your objectivity of your thinking? For example, do you tend to be overly-generous or selfish? Explain your answers thoroughly
Chapter 1 of our text casts the Spotlight on Nigeria, with a population of 186 million...
Chapter 1 of our text casts the Spotlight on Nigeria, with a population of 186 million and counting. Africa’s most populous country faces the curious challenge the comparative literature calls the “resource curse--” one that other resource-rich countries such as Iran, Venezuela, the Democratic Republic of the Congo, and South Sudan also grapple. The “curse” points to a situation in which an abundance of oil resources, instead of delivering higher living standards, a better quality of life, and economic prosperity...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT