What output will be produced by the following code? public class Demo { public static void main(String[]
Question:
What output will be produced by the following code?
public class Demo
{
public static void main(String[] args)
{
System.out.println("The output is:");
bar(11156);
System.out.println();
}
public static void bar(int number)
{
if (number > 0)
{
int d = number % 10;
boolean odd = (number / 10) % 2 == 1;
bar(number / 10);
if (odd)
System.out.print(d / 2 + 5);
else
System.out.print(d / 2);
}
}
}
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 60% (15 reviews)
The output is 05578 public class Demo2 public static void mainString arg...View the full answer
Answered By
ZIPPORAH KISIO LUNGI
I have worked on several other sites for more than five years, and I always handle clients work with due diligence and professionalism. Am versed with adequate experience in the fields mentioned above in which have delivered quality papers in research, thesis, essays, blog articles, and so forth.
I have gained extensive experience in assisting students to acquire top grades in biological, business and IT papers. Notwithstanding that, I have 7+ years of experience in corporate world software design and development.
5.00+
194+ Reviews
341+ Question Solved
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Question Posted:
Students also viewed these Computer science questions
-
What output will be produced by the following code? public class Demo { public static void main(String[] args) { System.out.println("The output is:"); foo(23); System.out.println(); } public static...
-
What output is produced by the following program? 1 public class CharMystery { public static void printRange (char startLetter, char endLetter) { for (char letter = startLetter; letter
-
What output is produced by the following program? 1 public class Odds { public static void main (String [] args) { printOdds (3); 4 printodds (17 / 2); int x = 25; printodds (37 - x + 1); 8 9. 10...
-
A manufacturer of diaphragm seals has identified the cash flows shown for manufacturing and sales functions. Determine the no-return payback period. First cost of equipment,....................$...
-
An inventor claims to have developed a heat pump that produces a 200-kW heating effect for a 293 K heated zone while only using 75 kW of power and a heat source at 273 K. Justify the validity of this...
-
The observed structure of [Sn 9 Tl] 3 is a bicapped square-antiprism. (a) Confirm that this is consistent with Wades rules. (b) How many isomers (retaining the bicapped square-antiprism core) of [Sn...
-
Help for Insomniacs A recent study shows that just one session of cognitive behavioral therapy can help people with insomnia. In the study, forty people who had been diagnosed with insomnia were...
-
A city has developed a plan to provide for future municipal water needs. The plan proposes an aqueduct that passes through 500 feet of tunnel in a nearby mountain. Two alternatives are being...
-
Riverbend Incorporated received a $ 2 2 2 , 5 0 0 dividend from stock it held in Hobble Corporation. Riverbend's taxable income is $ 2 , 8 0 0 , 0 0 0 before deducting the dividends - received...
-
1. How comparable are the two different methods? In what ways are they similar? In what ways are they different? 2. What are the positive and negative aspects of each approach that Shocker should...
-
Write a recursive method that will compute the number of odd digits in a number.
-
A palindrome is a string that reads the same forward and backward, such as "radar". Write a static recursive method that has one parameter of type String and returns true if the argument is a...
-
How have stocks performed in the past? The following table presents the data stored in Stock Performance, which show the performance of a broad measure of stock performance (by percentage) for each...
-
Mall Inc. issued a bond for $1,852,480 on October 1, Year 1. The face value of the bond is $2,000,000 and pays annual interest of 4.5%. The bond matures in six years. Mall reports under ASPE and has...
-
Peony Company's maintenance costs are shown below: Total Cost Total Units April $40,000 40,000 May 55,000 60,000 What type of cost is this?
-
Ali put $127.50 each month in a long-term investment account that earned 5.97% for 324 years. How much total interest did he earn?
-
Eliecer is about to begin repairing a mining equipment engine, the task must be done between two specialists, his co-worker went to the bathroom, but he needs to deliver the equipment and they are...
-
What are the costs of supporting e-commerce for a business? Provide high-level categories with cost estimates as high, medium, and low and cost type as variable or fixed.
-
Great Pumpkin Farms just paid a dividend of $3.50 on its stock. The growth rate in dividends is expected to be a constant 5 percent per year indefinitely. Investors require a 14 percent return on the...
-
Find the area of the surface generated by revolving the para- metric curve x = cos 1, y = sin? 1 (0 < I sa/2) about the y-axis.
-
Based on Figure 12.3, how do we interpret success in an Aloha network? Figure 12.3 Station has Legend a frame to send K : Number of attempts Tp: Maximum propagation time Tr: Average transmission time...
-
One of the useful parameters in a LAN is the number of bits that can fit in one meter of the medium (n b/m ). Find the value of n b/m if the data rate is 100 Mbps and the medium propagation speed is...
-
Another useful parameter in a LAN is the bit length of the medium (L b ), which defines the number of bits that the medium can hold at any time. Find the bit length of a LAN if the data rate is 100...
-
How do prokaryotes engage in sophisticated social behaviors, such as altruism and kin selection, and what genetic and ecological factors influence the evolution of these traits?
-
N Suppose for the integral T|[a,b] () = f f(x)dx, we approximate it with the midpoint method, which for mesh {x;} where xj = a + , = b-a N j=0 is given by N-1 1 A[a,b] (f) = 5x f (xj+1/2), where...
-
What are the structural and functional complexities of prokaryotic cell membranes, and how do they contribute to processes such as nutrient uptake, osmoregulation, and signal transduction?
Study smarter with the SolutionInn App