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...
C++ programming question Write a program that will read input from a text file called "theNumbers.txt"...
C++ programming question Write a program that will read input from a text file called "theNumbers.txt" (you will have to provide your own when debugging). The text file that is to be opened is formatted a certain way, namely, there is always one integer, one character (representing an operation), another integer, and then a new line character, with spaces between each item. A sample text file is provided below. theNumbers.txt 144 + 26 3 * 18 88 / 4 22...
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...
python programming • Appropriate and well constructed while and/or for loops (as necessary). • Appropriate if,...
python programming • Appropriate and well constructed while and/or for loops (as necessary). • Appropriate if, if-else, if-elif-else statements (as necessary). • The use of the ord() and chr() functions (as necessary). • The following three functions (refer to stage 6 for description): o display_details() o get_menu_choice() o get_offset() • Output that strictly adheres to the assignment specifications. If you are not sure about these details, you should check with the ‘Sample Output – Part II’ provided at the end...
Chapter 7, Problem 3PE from Introduction to Programming using Python by Y. Daniel Liang. Problem (The...
Chapter 7, Problem 3PE from Introduction to Programming using Python by Y. Daniel Liang. Problem (The Account class) Design a class named Account that contains: ■ A private int data field named id for the account. ■ A private float data field named balance for the account. ■ A private float data field named annualInterestRate that stores the current interest rate. ■ A constructor that creates an account with the specified id (default 0), initial balance (default 100), and annual...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT