Oct 20, 2012 at 2:12pm UTC
Your calCredit function sets the user's income to zero.
Oct 20, 2012 at 2:15pm UTC
You set worth to zero , so the first if is evaluated.
You need to send the worth value to the function calCredit, as well as the number of children.
Oct 20, 2012 at 2:51pm UTC
I think you are lucky, that you get the answer you do.
Try testing this with other values less than 70,000 - I doubt it will work.
There is a fundamental problem that I mentioned in my previous post.
If you manage to figure this out, I will explain why it gives the answer it does now. Another clue is that it will always give this answer.
Oct 20, 2012 at 3:40pm UTC
Now your function
calCredit sets worth to some random value. You've missed the point completely. You need to pass the value of worth to the function. See how you pass the number of children to the function? Like that.
You can pass more than one value to a function.
Last edited on
Oct 20, 2012 at 4:03pm UTC