Hi everyone, i've been trying to get this program to work for about 15 hours now and I dont understand why it won't work. I have tried trouble shooting and debugging myself but i'm failing to understand exactly what's wrong with my program. I'm trying to get the moneyowed to subtract 10000-principle. Principle is 3000-interest which means it SHOULD be subtracting 225, 226.69, etc etc after 2 months. instead it is giving me this error. I'm not asking for you to do this for me but just to point me in the right direction :( Thank you for your time in advance!
You could start by playing around with your equations. I just finished a project like this. If you can find out the actual interest rate
(ex. 5.25%) then you could just multiply that by your moneyowed to find interest and use that to find principle and so on. If you play around a little more with different equations then you will be able to better see what your program is actually doing.
are you suggesting i change in my loop moneyowed=10000; and then moneyowed=moneyowed-principle;? im a little confused :( or are you saying to place moneyowed=10000; outside of the loop and then place moneyowed=moneyowed-principle inside
of the loop? again thank
you so much for your help!
Set moneyowed = 10,000 outside of the loop and then in the loop place moneyowed = moneyowed - principle. This should give you the results you are looking for. Does it make sense why you would do this instead of what you are doing?
i thought about doing that but in my
mind if 10000 is outside of the loop and then its moneyowed=moneyowed-principle wouldnt it just do 10000 = 10000 - 9775
after the first month? that didnt make sense to me :( im an idiot.
No, it is a common misconception. The current value doesn't play a role on the left side of an equation (except in situations like where you used += in which case it does). Really what moneyowed = moneyowed - principle is doing is saying take the current value of money owed, subtract the principle from it, and then store it into moneyowed. You could accomplish the same thing by saying moneyowed -= principle if that makes more sense to you.
If you were to use == then this would compare the two values, and yes it would return false because the two are obviously not equal (unless principle equaled 0 at some point).