Here's my code:
b = a + (5 * Math.pow(10, -d));
b *= Math.pow(10, d);
b = Math.round(b * d);
b /= Math.pow(10, d);
Type: Posts; User: ghostheadx
Here's my code:
b = a + (5 * Math.pow(10, -d));
b *= Math.pow(10, d);
b = Math.round(b * d);
b /= Math.pow(10, d);
4.637 rounded would be 4.64.
--- Update ---
I'll see what he says. I sent him an email. If he says "no" which I believe he won't, what would you say to do?
I don't think he wants me to use Math.round() because he's never taught me that before. Are you sure there's no way to do it with casting? I know it works for one decimal place.
@summit45 Thanks for the help. I would really appreciate more experienced advice though. But you can still help. :)
Hi, I've been trying to get this problem to work for two days for my school. I'm just starting computer science class in Java. I really really really need help on my code. I've sent the teacher an...