Open martinjonsson01 opened 1 year ago
In most programming languages ^ is not used for exponentiation, it's used for logical XOR. So you're not taking the coordinates to the power of 2 here, you're XORing them with 2. Instead, use Math.pow(a, b).
^
Math.pow(a, b)
https://github.com/ghazalghorabi/TDA553-lab1/blob/01f3360df2ab6d8a3dae4522fac81312009bb5d9/src/CarShop.java#L40
https://github.com/ghazalghorabi/TDA553-lab1/blob/7f372da30e043f0290b53230226a6b7a94890562/src/Distance.java#L6
In most programming languages
^
is not used for exponentiation, it's used for logical XOR. So you're not taking the coordinates to the power of 2 here, you're XORing them with 2. Instead, useMath.pow(a, b)
.https://github.com/ghazalghorabi/TDA553-lab1/blob/01f3360df2ab6d8a3dae4522fac81312009bb5d9/src/CarShop.java#L40