+ 1

What will be the solution of New Driver's License (of Code Coach) in Java?

I got stuck at Case Test #5. I have searched for Java solution but found nowhere. Please help me to rectify it. https://code.sololearn.com/cq5q6Q46jDUH/?ref=app

10th Nov 2020, 5:40 PM
GiantJupiter
GiantJupiter - avatar
5 Antworten
+ 5
At line 34: Math.ceil(count/agent) Both count and agent are integers. Integer division will truncate the number to be an int. E.g: 3.0 / 2.0 is 1.5 but 3 / 2 is 1 Now, it should be clear why the code failed. Convert one of the operands to double and see.
11th Nov 2020, 2:24 AM
Kevin ★
+ 5
You are welcome😃
11th Nov 2020, 4:54 AM
Kevin ★
+ 5
Oh, I see that question now. What a coincidence😄
11th Nov 2020, 4:56 AM
Kevin ★
+ 1
I have passed the Test Case #5 and also solved the challenge. I have actually made another variable, count1, the double type version of count. Python is actually very different from Java. It has a flexibility upon data types, but only Python, C and C++ codes were present. I knew C++ till loops only, so I was unable to decipher the String functions. Lastly, Kevin, Thank you very very much for the tip.
11th Nov 2020, 4:45 AM
GiantJupiter
GiantJupiter - avatar
+ 1
https://www.sololearn.com/discuss/1941594/?ref=app The same problem happened with me.
11th Nov 2020, 4:51 AM
GiantJupiter
GiantJupiter - avatar