Don't know why method don't take value specified in the main method

Hi !

Here’s my code right above.

I didn’t have the result I expected when i call my “LoanCalculate” method. Its parameters (int carLoan, int loanLength, int downPayment) should change when i call it in the main method. For exemple i created an object “Patrick”.

Then I write:

Patrick.LoanCalculate(20000, 2, 7000);

Logically it should do this carLoan = 20000; loanLength = 2; downPayment = 7000. But they’re all equal 0. Any help? :slight_smile:

Thank you for reading !

if you look at your method the first thing it does is to discard the inputs


I was pretty sure it was an easy one but couldn’t find it.

 One mistake I shouldn't make again thanks to you :)

You can print out information to narrow down where the problem starts, so if you know it’s in the method then maybe you’d start by printing out at the very start of the method to see if the problem exists then, and maybe then you’d do the same thing somewhere in the middle or maybe at the end, and if you find two locations where the earlier one doesn’t have the problem and the later does, then you know the problem is between them and can continue searching there with more printing