Question: In Python: When it comes to buying on time, sometimes it's really hard to get the information you need. Suppose you want to buy a

In Python:

When it comes to buying "on time", sometimes it's really hard to get the information you need. Suppose you want to buy a new $3,500 computer system. Should you use your credit card, or finance it through the store? How much will your monthly payments be? How much lower will your payments be if you finance it over 3 years instead of 2?

GUI Specifics

This program uses seven Labels, three Entry, and one Button widget. Each widget is laid out using the Grid manager which has five rows by two columns. The Button has a command called calculate

The Math

Here's what you need to know to perform your calculations:

The formula to calculate a payment when the loan amount, interest rate, and term are all known is:

In Python: When it comes to buying "on time", sometimes it's really

When you perform your calculations you can use two of the numbers taken from the Entry widgets--loan amount and loan term--without any further processing.

You need to modify the interest rate variable, however, before you can use it because the user expects a monthly rate but the rate is being entered as a yearly rate. In addition, the rate entered by the user needs to be converted to a decimal percentage.

1. Since the user entered the interest rate as 7.5, rather than .075, the first step is to divide the interest rate by 100 and store the result back in the interest rate variable. This is the actual yearly interest rate.

2. The formula above, however, requires a monthly interest rate, not a yearly one. Divide the interest rate calculated in the previous step, this time by 12, and store the result back in your interest rate variable.

Once the interest rate is squared away create a new variable called payment and plug the rest of the variables into the formula shown above storing the result in payment. Python has an exponentiation operator feel free to use it or you can use the math.pow() function to calculate the "bottom" part of the interest calculation like this:

(1 - (math.pow(1/(1+rate), term * 12)))

loan amount x interest rate payment - 1 (1/ (1 + interest rate) term* 12

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!