What does the following program print? public class Mystery { public static void main(String[] args) { int
Question:
What does the following program print?
public class Mystery {
public static void main(String[] args) {
int x = 1;
int total = 0;
while (x <= 10) {
int y = x * x;
System.out.println(y);
total += y;
++x;
}
System.out.printf("Total is %d%n", total);
}
}
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 80% (10 reviews)
1 4 9 16 ...View the full answer
Answered By
Madhvendra Pandey
Hi! I am Madhvendra, and I am your new friend ready to help you in the field of business, accounting, and finance. I am a College graduate in B.Com, and currently pursuing a Chartered Accountancy course (i.e equivalent to CPA in the USA). I have around 3 years of experience in the field of Financial Accounts, finance and, business studies, thereby looking forward to sharing those experiences in such a way that finds suitable solutions to your query.
Thus, please feel free to contact me regarding the same.
5.00+
1+ Reviews
10+ Question Solved
Related Book For
Java How To Program Early Objects
ISBN: 9780134743356
11th Edition
Authors: Paul Deitel, Harvey Deitel
Question Posted:
Students also viewed these Computer science questions
-
What does the following program segment output? d = 0; do { System.out.print(d + " "); d++; } while (d < 2); a. 0 b. 0 1 c. 0 1 2 d. Nothing
-
What does the following program segment output? for(f = 0; f < 3; ++f) for(g = 0; g < 2; ++g) System.out.print(f + " " + g + " "); a. 0 0 0 1 1 0 1 1 2 0 2 1 b. 0 1 0 2 0 3 1 1 1 2 1 3 c. 0 1 0 2 1 1...
-
What does the following program segment output? for(m = 0; m < 4; ++m); for(n = 0; n < 2; ++n); System.out.print(m + " " + n + " "); a. 0 0 0 1 1 0 1 1 2 0 2 1 3 0 3 1 b. 0 1 0 2 1 1 1 2 2 1 2 2 c. 4...
-
Dwights preferences over beer and whiskey satisfy more is better, but are concave (thus violating the usual assumption of convexity). a. On a diagram, sketch what such indifference curves would look...
-
Atomic physicists ignore the effect of gravity within an atom. To see why, calculate and compare the gravitational and electrical forces between an electron and a proton separated by 10-10 m. The...
-
How can Domain-Driven Design (DDD) influence the structure and scalability of a large-scale enterprise application?
-
According to experimental results for parallel airflow over a uniform temperature, heated vertical plate, the effect of free convection on the heat transfer convection coefficient will be \(5 \%\)...
-
Operating data for Gallup Corporation are presented below. InstructionsPrepare a schedule showing a vertical analysis for 2011 and 2010. 2011 $750,000 465,000 120,000 60,000 33,000 72,000 2010 Sales...
-
Nike had sales of $44.487 billion in 2021. Suppose you expected its sales to grow at a rate of 18% in 2022, but then slow by 3% per year to the long-run growth rate that is characeristic of the...
-
Lenovo uses the ZX- 81 chip in some of its laptop computers. The prices for the chip during the past 12 months were as follows: a) Use a 2- month moving average on all the data and plot the averages...
-
Identify and correct the errors in each of the following pieces of code. a) int x = 1, total; while (x
-
What does the following program print? public class Mystery2 { public static void main(String[] args) { int count = 1; while (count
-
The Computer Anxiety Rating Scale (CARS) measures an individual's level of computer anxiety, on a scale from 20 (no anxiety) to 100 (highest level of anxiety). Researchers at Miami University...
-
After the FOMCs June 2023 meeting, an article in the Wall Street Journal noted that officials at the June meeting penciled in two more increases this year and the minutes said that projection would...
-
During a panel discussion, Randal Quarles, who was then a member of the Feds Board of Governors observed: The point about QE when we reach the zero lower bound is its a game changer. a. What is QE?...
-
It is not uncommon in startup circles to hear people say that they have a provisional patent or that they have protection from someone stealing their invention because they filed a provisional patent...
-
In a speech in 2022, Patricia Zobel, who was then an official of the Federal Reserve Bank of New York, noted that an ample supply of reserves ensures that control over the level of the federal funds...
-
In an article in the Economist, economist John Cochrane of Stanford Universitys Hoover Institution refers to the ideas of Milton Friedman, who died in 2006: Even Milton Friedman might change his mind...
-
How can companies adopt a holistic approach to managing new product development?
-
If your school has a subscription to the FASB Codification, go to aaahq.org/ ascLogin.cfm to log in and prepare responses to the following. (a) What is the stock dividend? (b) What is a stock split?...
-
Th is Exercise examines the single error correcting, double error detecting (SEC/DED) Hamming code. 1. What is the minimum number of parity bits required to protect a 128-bit word using the SEC/DED...
-
For a high-performance system such as a B-tree index for a database, the page size is determined mainly by the data size and disk performance. Assume that on average a B-tree index page is 70% full...
-
As described in Section 5.7, virtual memory uses a page table to track the mapping of virtual addresses to physical addresses. This exercise shows how this table must be updated as addresses are...
-
Annuity Payments Go to www.fcfcorp.com/onlinecalc.htm. Use the calculator to solve this problem. If you have $1,500,000 when you retire and want to withdraw an equal amount for the next 30 years, how...
-
Calculating Future Values Go to www.dinkytown.net and follow the Savings Calculator link. If you currently have $10,000 and invest this money at 9 percent, how much will you have in 30 years? Assume...
-
In 2023, Amanda and Jaxon Stuart have a daughter who is 1 year old. The Stuarts are full-time students and are both 23 years old. Their only sources of income are gains from stock they held for three...
Study smarter with the SolutionInn App