How to create a code in java?
Write an expression (or several expressions) that will round the variable x to 2 decimal places. It should work for any value that is stored in x. This should not produce a String, it must produce an actual double value! Just printing out the rounded value is not enough, the rounded value must be stored back in a double variable.
For example:
double x = 123.25032;
double z = [YOUR EXPRESSION HERE]
Your expression should result in z == 123.25.
If x = 52.118907, then z == 52.12.
If x = 9.4512, then z == 9.45.
If x = 9.455, then z == 9.46.