The following program issues an error(s). Explain why and how to fix it. (10points) 3 package...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
The following program issues an error(s). Explain why and how to fix it. (10points) 3 package taesik; 4 public class mq3 { 5 6 7 8 9 10 11 12 13 14 15 16 17 18} 56 public static void main(String[] args) { int sum=0; int result; } for (int i = 0; i<3; i+=2) { sum += i; } result = sum + i; System.out.println(result); The following program issues an error(s). Explain why and how to fix it. (10points) 3 package taesik; 4 public class mq3 { 5 6 7 8 9 10 11 12 13 14 15 16 17 18} 56 public static void main(String[] args) { int sum=0; int result; } for (int i = 0; i<3; i+=2) { sum += i; } result = sum + i; System.out.println(result);
Expert Answer:
Answer rating: 100% (QA)
It seems there is an error in your Java program The issue is with the scope of the variab... View the full answer
Related Book For
Introduction To Programming With Java A Problem Solving Approach
ISBN: 9781260575248
3rd International Edition
Authors: John Dean
Posted Date:
Students also viewed these programming questions
-
In the following normal form game: A B C a 12; -7 10:2 0,9 B 10:1 2:4 8:5 8 4:5 8:14 16: -3 (a) (3 points) Find the pure strategy best responses. You may mark the game table but you will loose a...
-
It is initially at 25\deg C. The warehouse is desired to be cooled to 5\deg C. The heat transferred from the external environment to the tank is 1.2 kW. Accordingly, a cooling system with H kW power...
-
a) If the block is at rest (and the only forces acting on the block are the force due to gravity and the normal force from the table), what is the magnitude of the force due to friction? b) Suppose...
-
What is the annual interest amount for a $1,000 bond that pays 7 3 / 4 percent interest?
-
Match the graph of the function with the graph of its derivative. [The graphs of the derivatives are labeled (a), (b), (c), and (d).] (a) (b) (c) (d) y 3 VAA 2 -2 -3+ X
-
In the past five years, there have been significant innovations in technology such as smartphones and tablets. Technology companies rely on intellectual property (IP) rights, such as patents,...
-
Upton Computers makes bulk purchases of small computers, stocks them in conveniently located warehouses, ships them to its chain of retail stores, and has a staff to advise customers and help them...
-
If f(x) = x + 3 and g(x) = x + 8x + 15. Determine an equation for y = f(x) * g(x)
-
Kennedy Prisby, age 33, is single and has no dependents. Her social security number is 111-22-3333. Her address is 101 North Fork Ave., Cedar City, UT 84720. She has no intention of donating to the...
-
1. The maximum number of cars accepted is 30. 2. The entrance and exit of cars are detected by the installed ultrasonic sensors (entrance and exit sensors) at the gate. 3. The design has to have the...
-
Business and Society: Stakeholders, Ethics, Public Policy Edition: 17th Author:Anne Lawrence,James Weber ISBN10:1264767064 Page 404 - 1 Failure by Design: Boeing and the 737 Max What were the...
-
Elmo Hams breeds and sells pigs. His records disclosed the following: Quantity Value ($) Pigs on Hand - beginning of year 3400 72100 Purchases 900 38200 Natural Increase 1100 Sales 2900 161500...
-
In September 2018, Hangzhou All Venture Capital (HAVC), an investment arm of Alibaba, purchased 218 million shares of One97Communications (One97C) in a private placement, which represents 25% of the...
-
If WACC is 7.28%, perpetual (terminal) growth rate is 2.8%, non-operating assets equal $290,000 and debt/non-equity claims equal $179,500, calculate the Discounted Cash Flow value given the unlevered...
-
In our text Our Iceberg Is Melting , Kotter provides a story-based scenario of a situation needing a change intervention. Review the reading from our text and state how Kotter's last four steps (5...
-
Record transactions for the following transaction and prepare financial statements including trial balance for July 2019. A. Peter invested $10,000 in the business from his personal saving account....
-
As of January 1, 2018, Room Designs, Inc. had a balance of $9,900 in Cash, $3,500 in Common Stock, and $6,400 in Retained Earnings. These were the only accounts with balances in the ledger on January...
-
In the FactorialButton program in Figures 17.8a and 17.8b, what component fires the event that the listener handles? Figures 17.8a: Figures 17.8b: /********************************** *...
-
Whenever a programmer is asked to enhance existing program, there is risk of introducing a bug that breaks something that was not broken in the original program. a) What should the original...
-
If you want a class to handle an event, what clause must be added to the right side of the classs heading?
-
A diffraction grating is a closely spaced array of apertures or obstacles forming a series of closely spaced slits. The simplest type in which an incoming wave front meets alternating opaque and...
-
Find the position of the first minimum for a single slit of width 0.04 \(\mathrm{mm}\) on a screen of \(2 \mathrm{~m}\) distance, when light from a He-Ne laser \(\lambda=\) 6328 is shone on the slit.
-
A GaAs p-n junction has a \(100 \mu \mathrm{m} \times 100 \mathrm{~m}\) cross section and a width of the depletion layer \(W=440 \mathrm{~nm}\). Consider the junction in thermal equilibrium without...
Study smarter with the SolutionInn App