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...
-
Timmins Company of Emporia, Kansas, spreads herbicides and applies liquid fertilizer for local farmers. On May 31, 2017, the company's Cash account per its general ledger showed a balance of...
-
The December 31, 20X8, balance sheets for Pint Corporation and its 70 percent-owned subsidiary Saloon Company contained the following summarized amounts: PINT CORPORATION AND SALOON COMPANY Balance...
-
During February, Peters Hardware made sales of \($38,600\) and ended the month with inventories totaling \($5,400.\) Cost of Goods Sold was \($23,200.\) Total operating expenses were \($8,700.\) How...
-
Compare and contrast the arms-length or adversarial approach to the partnership approach to building customer-supplier relationships.
-
Tempo Company's fixed budget (based on sales of 18,000 units) folllows. Fixed Budget Sales (18,000 units x $205 per unit) Costs Direct materials Direct labor Indirect materials Supervisor salary...
-
Ryan Ross (111-11-1112), Oscar Omega (222-22-2222), Clark Carey (333-33-3333), and Kim Kardigan (444-44-4444) are equal active members in ROCK the Ages LLC. ROCK serves as agents and managers for...
-
Q1. Define the concepts of outsourcing and third party logistics. What role does transportation play in 3PL?
-
1. Starting from home, you bicycle 23km north in 2.4 hand then turn around and pedal straight home in 1.4h. What are your (a) displacement at the end of the first 2.4h, (Express your answer using...
-
What is product management ? Explain its scope and benefits.
-
Problem 3. What minimum volume V of helium is needed if a balloon is to lift a load of 185 kg. The density of helium is 0.179 and the density of air is 1.29 (disregard the empty balloon's weight). m
-
2. Consider the following vectors: a =-2j+3k, b2i3k, c = -3i+2j Compute the required vectors operations. a. a+b-c [2] b. a.b [2] c. (axb) c [4] d. (cxb) xal [4] 3. Consider the vector a = < -3,2,-1>...
-
Discuss challenges to the implementation of a HIT plan for a healthcare organization which will effectively capture the important data points which can be used to monitor health outcomes. Provide...
-
Solve and find the value of X: a = 0.16, b = 0.2, c = 0.14, d = 0.01, a = b (c- d) + d +x
-
You are interested in investing and are considering a portfolio comprised of the following two stocks. Their estimated returns under varying market conditions are provided: (note: it is difficult to...
-
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...
-
Can we use any trial vector \(\vec{X}_{1}\) in the matrix iteration method to find the largest natural frequency?
-
Rayleigh's method a. Finds the natural frequencies and mode shapes of the system, one at a time, using several trial values for each frequency. b. Finds all the natural frequencies using trial...
-
Fill in the Blank. For a shaft carrying masses \(m_{1}, m_{2}, \ldots\), Rayleigh's method gives the natural frequency as \[\omega=\left\{\frac{g\left(m_{1} w_{1}+m_{2} w_{2}+\cdots ight)}{m_{1}...
Study smarter with the SolutionInn App