why does the method ageDog() not work correctly? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

why does the method ageDog() not work correctly?

hello! i'm trying to create a simple class for a dog - in it you're supposed to be able to get the tail length of a dog by using the calculation: age * weight / 10 (with exceptions for one breed), as well as increase a dog's age by 1 year. the problem with this is that in the VPL/JUnit tests i have to use, the age doesn't increase. for the calculation it just takes the initial, even in cases where it's supposed to use the updated age, and so the tail length is incorrect. say that after the age has updated, the calculation should like this: age (4) * weight (7) / 10 = 2.8. but what it gives me instead is age (3) * weight (7) / 10 = 2.1. i'm guessing that there is something wrong with my ageDog() method or that it doesn't print/return correctly, but i can't figure out what. i've been working on this for days with not a lot of progress, so i would be very thankful for any type of advice! here below is the code - note that it does work in regular IDE's since it can take in whichever values you give it in the main method, but like i said i want to figure out how to successfully increase the age based on said values. https://code.sololearn.com/cSg04bcqsrDE/#java

16th Dec 2021, 2:49 AM
jules
jules - avatar
1 Answer
+ 1
jules Where are you using ageDog() in your code. You have just declared it.
16th Dec 2021, 3:59 AM
A͢J
A͢J - avatar