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 email but I'm scared I won't get a response in time. I think I'm good at this class but I've only been doing it for a week or so. I have very little time to finish. Please help.

By the way, I know how to round to one digit. Just not a variable number of digits.

Here is the problem:

"In the following segment of code, a and b are non-negative doubles and d is an int between 0 and 5 (inclusive). Write code that assigns to b the result of rounding a to d decimal places."

Help appreciated. Thanks.