Introduction

  1. The scope of this project was to create an application with a graphical user interface that anyone could use with or without any coding experience. Investment and real estate calculations were the focus of this application.
  2. The application was to be used to find the following below.
    • Capitalization Rate
    • Net Present Value
    • Maximum Initial Investment
    • Internal Rate of Return
    • Profitability Index
    • Cash on Cash Return
    • Net Operating Income
    • Operating Margin
    • Loan Payment Amount
  3. To begin this project, I started without using Tkinter. I created the calculations without the graphical user interface to make sure the code I was writing actually worked and running this without using the graphical user interface made it easier to debug if the answers were not coming out correct.

Beginning the Code

To begin working on the code for this project, hand calculations of the net present value (NPV) were performed to back test the code after it was created.

The second formula hand calculations were performed for was for the internal rate of return (IRR).

The NPV code shown is where the project first started. A simple for loop was used to create the calculation for net present value. The mathematical formula used to write the code is also shown. 

After the net present value code was made, it was used further to create a calculation for internal rate of return as shown. An additional for loop was added to iterate over the added if statement until the net present value equals zero.

Starting with Tkinter

Once the calculations from the code had been tested, the code was then incorporated into the graphical user interface of Tkinter. This fist portion of code shows importing Tkinter and creating the instance of Tkinter running, as well as creating all the initial buttons for this project. The only button shown in the code below is for the CAP rate calculator, but multiple other buttons were created similarly for the other calculators.

The initial window that pops up is this window with buttons for each of the calculators.

CAP Rate Calculator

When the CAP Rate calculator button is pressed, it initiates the NOI function code as well as removing the main window so only the CAP rate calculator window is visible

The cap rate calculator uses the net operating income and property value to calculate the cap rate percentage. The clear button clears all the text boxes, and the back to home page button takes you back to the original page with all the calculator buttons.

The underlying code of each of the buttons can be seen here.

NPV Calculator, Max Initial Investment Calculator, Internal Rate of Return Calculator, and Profitability Index Calculator

The buttons NPV Calculator, Max Initial Investment Calculator, Internal Rate of Return Calculator, and Profitability Index Calculator take you to the window seen here.

The code here shows the functionality of this window. To first determine the solutions for each of these finance instruments, a time frame of investment needs to be determined. For the sake of this project, I limited the amount of years of investment to 10 years as shown in the if statement. This was done due to the layout I chose from the amount of years. The layout was a simple stack of text boxes for years on top of each other (as can be seen in the next window). With this layout, if too many years were added, the text boxes would go off  the screen.) This layout method is shown in the for x in range(adj_years) for loop. To create the layout for more than 10 years, I could write if and else if statements in the for loop that create new columns for each year text boxes at 10 year increments.  

Once the years are selected, and the “Press to add years” button is clicked, the window below is shown. All of the text boxes on the left are the input values. For the sake of time in this project, I did not include any safety nets for commas, percent signs, or whole numbers in the input text boxes, but for full functionality of a user these would need to be added so no errors occur. For example, this discount rate must be as a decimal and not inputted at 8 (or 8%). Instead of accommodating for this in the code, I put decimal in parentheses to let the user know. Once all the inputs are in, any of the buttons below can be pressed to calculate the desired output.

The code below shows what the start over button executes. This takes you back to the original add years window to adjust the amount of years for the investment.

The buttons Cash on cash return, NOI/Operating Margin, and Loan Payment Calculators on the main page takes you to the window below. This window could again have a cleaner layout, but the purpose of this project was to create an accurate functioning GUI and layout was not a focus. The text boxes on the left are in the input, and the text boxes on the right are the output. The sequence of calculations needs to begin with the top button (Calculate Net Operating Income) and then move down. The reason for this is to calculate before tax cash flow, the net operating income and annual loan payment text boxes need to populated. The before tax cash flow text box needs to be populated before the cash on cash return can be calculated. The formulas for these calculations were more straight forwards than the previous formulas, and therefore, no complex if statement or for loops were required. For this section, I included concatenating $ signs and % signs in the outputs to make the outputs look cleaner. Therefore, to calculate the before tax cash flow using net operating income and annual loan payments, I split on the $ sign so the computer could accurately read the number by itself.

Conclusion

In conclusion, this project taught me a lot of the ins and outs of application development. Through trial and error of writing code and then using the application, many issues were found that would not have been found from immediately just writing and looking at the code alone. A perfect example would be pressing the calculate button a second time after the output boxes were already populated. Originally, the calculate buttons did not have a clear all function inside of them. This caused the solution from the first time the button was pressed to remain and the text box and then the second solution to pop up beside it in the text box. For example, pressing calculate in image 1 gives 6%, and then changing the NOI to 15000 and pressing calculate again would give image 2. After seeing this, I realized that the calculate button needed to have a clear text box function in the beginning of the calculate function and then followed but inserting the new values. This is one of the many skills that were learned through developing and operating this application. Overall, I believe the most useful knowledge gained from this project, was the appropriate ways to indent python code so the computer knows which functions take priority. This project required nesting functions inside of nested function so the layout of the code was extremely import so the computer could know which functions needed to be executed. Reflecting on this project, many paths could be taken to make this application much better. The main paths that come to mind are formatting the layout to be much cleaner and making it more obvious to the user which text boxes are inputs, as well as, making the sequence of some portions more straight forward. Thank you for taking the time to read through this outline of my project, and I hope we get to work together.

Image 1
Image 2