Which piece of code calculates an average - preserving precision - and displays it to 2...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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); 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);
Expert Answer:
Answer rating: 100% (QA)
The detailed answer for the above question is provided below The correct code is Java int test1 ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
re Regular Languages and Finite Automata (a) Let L be the set of all strings over the alphabet {a, b} that end in a and do not contain the substring bb. Describe a deterministic finite automaton...
-
(a) Explain how a limit worth may be tended to at run-time, both in a syntaxtree middle person and in collected code. What is the importance word "settled" already? [3 marks] (b) Give a model program...
-
Investor's Report Objectives: You will conduct financial statement analysis of two comparable companies and provide recommendations about the financial position about each for two investors. Select...
-
A ceiling fan is rotating at 0.96 rev/s. When turned off, it slows uniformly to a stop in 2.4 min. (a) How many revolutions does the fan make in this time? (b) Using the result from part (a), find...
-
Which options normally need to be chosen to solve a linear programming model?
-
Police in Albemarle County, Virginia, were on the lookout for a stolen orange and black motorcycle that had eluded them in two previous traffic incidents. Officer David Rhodes drove past the home of...
-
The president of the retailer Prime Products has just approached the companys bank with a request for a $30,000, 90-day loan. The purpose of the loan is to assist the company in acquiring...
-
1. (10) A $10 000 bond was issued on January 1st 2015 with a coupon rate of 9.7% and a redemption date of January 1st 2025. What is the purchase price of the bond on January 1st, 2022 when the yield...
-
In the investment world, commodities are typically pretty boring. From livestock to grains to steel and other metals, commodities have their ups and downs. But long term, the world will always need...
-
In the first case, the relationship between F and H is found to be inverse when the height decrease the area will increase, and the force will increase too. Therefore, I need a logical and practical...
-
In the figure here, a cylinder having a mass of 1.9 kg can rotate about its central axis through point O. Forces are applied as shown: F-1.7 N, F = 8.4 N, F3 = 6.4 N, and F4 = 7.9 N. Also, r = 3.5 cm...
-
A block of mass M = 1.3 kg, connected by a cord and pulley to a hanging block of mass m = 4.4 kg, slides and accelerates across a surface with coefficient of kinetic friction k = 0.13. Find the...
-
A particle of mass m moves along the horizontal z-axis under the influence of a force F away from the origin O in such a manner that its position at any instant of time t is x = x(t) = ne-kt cos wt...
-
"Murray (age 68, single) sold his home owned for 35 years so that he could relocate to a place that is closer to where his grandchildren live. He realized a $400,000 capital gain on the home....
-
Which statement about concessions is false? (a) Concessions are central to negotiations (b) Immediate concessions are perceived less valuable than gradual, delayed concessions (c) Packaging...
-
The inventory of Oheto Company on December 31, 2017, consists of the following items. Part Quantity Cost per Unit Net Realizable Value 110 600 95 100 111 1000 60 52 112 500 80 76 113 200 170 180 120...
-
What is the expected payoff of an investment that yields $5,000 with a probability of 0.15 and $500 with a probability of 0.85? Select one: O a. $325 O b. $5,500 O c. $2,750 O d. $1,175
-
Using the switch statement, write the C++ code that corresponds to the partial flowchart shown in Figure 6-36. Use a char variable named code and a double variable named rate.
-
If necessary, create a new project named TryThis11 Project, and save it in the Cpp8\Chap10 folder. Code the IPO charts shown in Figure 10-26. Enter your C++ instructions into a source file named...
-
First, complete TRY THIS Exercise 1. Then, if necessary, create a new project named TryThis8 Project, and save it in the Cpp8\Chap04 folder. Enter the C++ instructions from TRY THIS Exercise 1 into a...
-
Santinis new contract for 2019 indicates the following compensation and benefits: Santini is 54 years old at the end of 2019. He is single and has no dependents. Assume that the employer matches $1...
-
In 2019, Nina contributes 10 percent of her $100,000 annual salary to her 401(k) account. She expects to earn a 7 percent before-tax rate of return. Assuming she leaves this (and any employer...
-
In 2019, Nitai (age 40) contributes 10 percent of his $100,000 annual salary to a Roth 401(k) account sponsored by his employer, AY Inc. AY Inc. matches employee contributions to the employees...
Study smarter with the SolutionInn App