[Solved] return issue for method in java [closed]


based on the following formula: one knot for every 10 million spent
plus one more for each of the crew who own a house in New Zealand.

What you did is multiply using *. You want to divide. Say you have:

  • Below 10 million, then you want 0 knots.

  • 10 million, then you want 1 knot.

  • 20 million, then you want 2 knots.

  • 30 million, then you want 3 knots.

To do do this you need money divided by 10 million:

int knot = money/10000000 + people;

This is assuming that your people variable represents the number of people who own a house in New Zealand. Since we are using int data types, we shouldn’t have to worrying about decimal values when dividing (using /). It’ll just automatically round down to the nearest whole integer.

solved return issue for method in java [closed]