Question

My library>CptS 111 home> 2.9: zyLab PA #1: Student Loan R oks zyBooks cat @Help/FAQ θ Mohammed Al Shukaili 2.9 zyLabPA#1:Student Loan RepaymentCalculator For this assignment you wil write a program to calculate the monthly payments required to pay back a student loan You vill need to prompt the user for the following values Annual interest rate (as a percentage) Number of years to repay loan . and display the output in a readable form. Output should include Amount of monthly payment Total amount paid . e Total interest paid The formula for calculating monthly payments is given by P(i/12) p,P, i, n are the monthly payment amount, the principal loan amount, the annual interest rate as a fraction, and the number of monthly payments, respectively. In your program, use appropriate names for your variables that are descriptive, and also be sure to comment your code. Because it will be some time before we learn how to format output, use the int0 function to get approximate values for your output and to make it look better (and also to make your answers correct for the auto-graderl) Heres an example Enter the amount you owe [no commas]: 30000 Enter the interest rate [8]: 6 Enter the number of years you want to spend to pay back your loan: 10 Your monthly payment is $333. The total amount you ended up paying is $39967. The total amount of interest you paid is $9967.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

The output snapshot is followed by the python code:

saved share input clear Python 3.6.1 (default, Dec 2015, 13:05:11) [GCC 4.8.2] on linux principal = input(Enter the amount y

principal = input("Enter the amount you owe [no commas]: ");
rate = input("Enter the interest rate [%]: ");
years = input("Enter the number of years you want to spend to pay back your loan: ");

principal = float(principal);
rate = float(rate);
years = float(years);

print(str(principal));
print(str(rate));
print(str(years));

numberofmonthlypayment = 12.0 * years;
monthlypayment = (principal * rate * 0.01 / 12.0) / (1.0 - ((1.0 + rate * 0.01/12.0) ** (-1.0 * numberofmonthlypayment)));

print("Your monthly payment is $" + str(int(monthlypayment)) + ".");
print("The total amount you ended up paying is $" + str(int(monthlypayment * numberofmonthlypayment)) + ".");
print("The total amount of interest you paid is $" + str(int(monthlypayment * numberofmonthlypayment - principal)) + ".");

Add a comment
Know the answer?
Add Answer to:
My library>CptS 111 home> 2.9: zyLab PA #1: Student Loan R oks zyBooks cat @Help/FAQ θ...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • RETIRING STUDENT LOAN DEBT You have just started a new job with a significant increase in...

    RETIRING STUDENT LOAN DEBT You have just started a new job with a significant increase in salary above what you were earning when you originally negotiated your student loan repayment. The salary increase affords you the opportunity of increasing your monthly loan payments, thereby allowing you to retire the debt sooner than originally planned. You have six years remaining in the original payback plan on a loan of $55,000, with an interest rate of 2.4% and a monthly payment of...

  • Suppose you have a student loan of ​$50000 with an APR of 12​% for 40 years....

    Suppose you have a student loan of ​$50000 with an APR of 12​% for 40 years. a. What are your required monthly​ payments? The required monthly payment is ​$ ___ ​(Do not round until the final answer. Then round to the nearest cent as​ needed.) If paid off in 20 years? The percentage of the total paid that is interest is ?

  • Compare three student loans for $80,000 for 4 years of college. Compare varying student loan offers,...

    Compare three student loans for $80,000 for 4 years of college. Compare varying student loan offers, their monthly payments and total repayment cost. Three possible examples: Student 1) immediately. A loan at fixed 6.25% that you pay for 10 years starting right away as a normal installment loan, Student 2) Pay interest only. Pay interest at fixed 6.25% for the four years you are in college. Then for 6 years after college, pay the loan as a 6 year installment...

  • MATLAB!!! CAN SOMEONE SOLVE THIS PROBLEM ON MATLAB?? THANK YOU PART B: HOUSING LOAN CALCULATOR In this part of the assignment, you are expected to develop a program that calculates housing loan pay-...

    MATLAB!!! CAN SOMEONE SOLVE THIS PROBLEM ON MATLAB?? THANK YOU PART B: HOUSING LOAN CALCULATOR In this part of the assignment, you are expected to develop a program that calculates housing loan pay- ments based on compound interest formulas The program should prompt a user to input the amount borrowed (principal), p, the number of monthly payments, n, and an annual interest rate in R percent. The program should convert the annual interest rate R into a monthly interest rate...

  • Mortgage Amortization Complete the loan amortization schedule for a Mortgage that will be repaid over 360...

    Mortgage Amortization Complete the loan amortization schedule for a Mortgage that will be repaid over 360 months and answer the following questions (The details about the loan are shown below): Correct Answers 1. What is your monthly payment? 2. What is the total $ amount of payments made over the life of the loan Enter Answers Here. 3. How many months will it take to pay off the loan if you pay an extra $465.71 per month? Note: Enter the...

  • 19. Monthly Payments The monthly payment on a loan may be calculated by the following formula:...

    19. Monthly Payments The monthly payment on a loan may be calculated by the following formula: Rate (1Rate) ((1 Rate)N - 1) Payment - Rate is the monthly interest rate, which is the annual interest rate divided by 12" (12% annual interest would be 1 percent monthly interest.) N is the number of payments, and L is the amount of the loan. Write a program that asks for these values and displays a report similar to Loan Amount: Monthly Interest...

  • The program is in python :) Write a code program to calculate the mortgage payment. The...

    The program is in python :) Write a code program to calculate the mortgage payment. The equation for calculating the mortgage payment is: M = P (1+r)n (1+r)n-1 Where: M is your monthly payment P is your principal r is your monthly interest rate, calculated by dividing your annual interest rate by 12. n is your number of payments (the number of months you will be paying the loan) Example: You have a $100,000 mortgage loan with 6 percent annual...

  • 8. Calculating an installment loan payment using simple interest Calculating the Loan Payment on a Simple-Interest...

    8. Calculating an installment loan payment using simple interest Calculating the Loan Payment on a Simple-Interest Installment Loan Instaliment loans allow borrowers to repay the loan with periodic payments over time. They are more common than single-payment loans because it is easier for most people to pay a fixed amount periodically (usually monthly) than budget for paying one big amount in the future. Interest on installment loans may be computed using the simple interest method or the add-on method. For...

  • When you borrow money to buy a house, a car, or for some other purpose, you...

    When you borrow money to buy a house, a car, or for some other purpose, you repay the loan by making periodic payments over a certain period of time. Of course, the lending company will charge interest on the loan. Every periodic payment consists of the interest on the loan and the payment toward the principal amount. To be specific, suppose that you borrow $1,000 at an interest rate of 7.2% per year and the payments are monthly. Suppose that...

  • You have an outstanding student loan with required payments of $600 per month for the next...

    You have an outstanding student loan with required payments of $600 per month for the next four years. The interest rate on the loan is 9% APR (compounded monthly). Now that you realize your best investment is to prepay your student loan, you decide to prepay as much as you can each month Looking at your budget, you can afford to pay an extra $250 a month in addition to your required monthly payments of $600, or $850 in total...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT