I am in a Java programming online class so my professor is 0 help. I would appreciate any input anyone can give.

I am writing a program for standard deviation which I have down just fine, however the numbers my program outputs have 16 places beyond the decimal point. ( 3.1100000000000003) How can I shorten this down to just 2 places beyond the decimal point (3.11)

I will embed my code if it will help:

import java.util.Scanner; public class Test3 { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter first number: "); double first = input.nextDouble(); System.out.print("Enter second number: "); double second = input.nextDouble(); System.out.print("Enter third number: "); double third = input.nextDouble(); System.out.print("Enter fourth number: "); double fourth = input.nextDouble(); System.out.print("Enter fifth number: "); double fifth = input.nextDouble(); System.out.print("Enter sixth number: "); double sixth = input.nextDouble(); System.out.print("Enter seventh number: "); double seventh = input.nextDouble(); System.out.print("Enter eighth number: "); double eighth = input.nextDouble(); System.out.print("Enter ninth number: "); double ninth = input.nextDouble(); System.out.print("Enter tenth number: "); double tenth = input.nextDouble(); double mean = ((first + second + third + fourth + fifth + sixth + seventh + eighth + ninth + tenth)/ 10); double variance = ((10 - mean) * (10 - mean))/10; double deviation = Math.sqrt(variance); System.out.println("The mean is: " + mean); System.out.println("The standard deviation is: " + deviation); } }

Thanks so much!!