+ 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
5 Answers
+ 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.
+ 5
You are welcomeđ
+ 5
Oh, I see that question now. What a coincidenceđ
+ 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.
+ 1
https://www.sololearn.com/discuss/1941594/?ref=app
The same problem happened with me.