Question: Which piece of code calculates an average - preserving precision - and displays it to 2 decimal places? O int test1 = 90, test2

Which piece of code calculates an average - preserving precision - and

Which piece of code calculates an average - preserving precision - and displays it to 2 decimal places? O int test1 = 90, test2 = 85, test3 = 87, sum; double average; sum = test1 + test2 + test3; average = sum / 3.0; System.out.printf ("The average is %.2f%n", average); int test1 = 90, test2 = 85, test3 = 87, sum; double average; sum test1 + test2 + test3; average = sum / 3; System.out.printf("The average is %f%n", average); O int test1 = 90, test2 = 85, test3 = 87, sum; double average; sum test1 + test2 + test3; average = sum / 3.0; System.out.printf ("The average is %d%n", sum); Oint test1 = 90, test2 = 85, test3 = 87, sum; double average; sum test1 + test2 + test3; average sum / 3; System.out.printf("The average is %.2f%n", average);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The detailed answer for the above question is provided below The correct code is Java int test1 ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!