Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
The detailed answer for the above question is provided below The correct code is Java int test1 ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started