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...
-
A particles position on the x-axis is given by the function x = (t 2 - 4t + 2) m, where t is in s. a. Make a position-versus-time graph for the interval 0 s t 5 s. Do this by calculating and...
-
For a certain incompressible, two-dimensional flow field the velocity component in the \(y\) direction is given by the equation \[ v=3 x y+x^{2} y \] Determine the velocity component in the \(x\)...
-
Refer to the data for Auto Lavage in Exercise 99. The actual operating results for October appear below: In Exercise 99, Auto Lavage is a Canadian company that owns and operates a large automatic...
-
1. What surprised you the most about radiation in our surroundings daily? Would you recommend this learning resource to family and friends? Why? https://www.epa.gov/radtown/radiation-sources-house
-
A railway wagon weighing 50 kN and moving with a speed of 8 km per hour has to be stopped by four buffer springs in which the maximum compression allowed is 220 mm. Find the number of turns in each...
-
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...
-
Find a recent news report in which a statistical study led to a conclusion of causation. Describe the study and the claimed causation. Do you think the claim of causation is legitimate? Explain.
-
Palepu Company owns and operates a delivery van that originally cost \(\$ 28,200\). Palepu has recorded straight-line depreciation on the van for four years, calculated assuming a \(\$ 3,000\)...
-
What is the current U.S. GAAP accounting treatment for research and development costs? How does this accounting treatment differ for IFRS? Why are R\&D costs normally not capitalized under U.S. GAAP?
-
On January 2, 2013, Dechow Company purchases a machine that manufactures a part for one of its key products. The machine cost \(\$ 220,500\) and is estimated to have a useful life of six years, with...
-
Companies are aware that analysts focus on profitability in evaluating financial performance. Managers have historically utilized a number of methods to improve reported profitability that are...
-
Sloan Company owns an executive plane that originally cost \(\$ 920,000\). It has recorded straight-line depreciation on the plane for seven full years, calculated assuming an \(\$ 80,000\) expected...
-
According to Equation 20.7, an ac voltage V is given as a function of time t by V = V0 sin 2ft, where V0 is the peak voltage and f is the frequency (in hertz). For a frequency of 60.0 Hz, what is 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...
-
Draw the shear diagram for the beam. Set P = 600 lb, a = 5 ft, b = 7 ft. Draw the moment diagram for the beam.
-
Ahmed, Bassem and Jamal are partners in Tadamon Company who share profits and losses at a ratio of 2 : 2 : 4 respectively. On 1 / 1 / 2 0 2 2 , it was decided to liquidate the company, and the...
-
Draw the shear diagram for the beam. Follow the sign convention. Draw the moment diagram for the beam. Follow the sign convention.
Study smarter with the SolutionInn App