Question: Write a python program that uses seven Labels, three Entry, and one Button widget. Each widget is laid out using the Grid manager which has

Write a python program that 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

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:

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

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.

Here's what you need to do:

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.

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)))

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!