Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I just learned something in java today. i use eclipse atschool. and i think it\'

ID: 3613706 • Letter: I

Question

I just learned something in java today. i use eclipse atschool. and i think it's called modules or something. for exampleif you want 8/3 you have to type 8%3. and then to get more decimalplaces you have to do something extra. What would be an example of a class that used a couple ofmodules and exact decimals (like 8.03 or something) ? I'm somewhatconfused.. Thank you! I just learned something in java today. i use eclipse atschool. and i think it's called modules or something. for exampleif you want 8/3 you have to type 8%3. and then to get more decimalplaces you have to do something extra. What would be an example of a class that used a couple ofmodules and exact decimals (like 8.03 or something) ? I'm somewhatconfused.. Thank you!

Explanation / Answer

please rate - thanks I think your talking about modular arithmetic Java has an arithmetic operator % which returns the remainder of adivision, just like when you first learned division in elementaryschool This operator only works forintegers and it returns the remainder of a/b so for example c=5%3;             Read c=5 mod 3       c will be 2.   5/3 is 1 remainder 2 c=8%2; c will be 0. 8/2 is 4 remainder 0 an application of this would be int a,c; c=a%2;       if the result in c is 1 thevalue in a is an odd number, if the result is 0 the value in a iseven                  If you think about it. If you divide any even number by 2 it willhave no remainder, but if you divide an odd number by 2 it willhave a remainder of 1