Determine the output from the following code segment: int sum = 2; int number = 3; do
Question:
Determine the output from the following code segment:
Transcribed Image Text:
int sum = 2; int number = 3; do { sum = sum + number; number++; System.out.println("sum " + sum) ; System.out.println ("number = " + number); } while (sum < 3* number); System.out.println ("sum = " + sum); System.out.println ("number = "+ number);
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 66% (3 reviews)
The code is written in Java and uses a dowhile loop To determine the output well need to walk through the loops logic step by step Here are the initia...View the full answer
Answered By
Utsab mitra
I have the expertise to deliver these subjects to college and higher-level students. The services would involve only solving assignments, homework help, and others.
I have experience in delivering these subjects for the last 6 years on a freelancing basis in different companies around the globe. I am CMA certified and CGMA UK. I have professional experience of 18 years in the industry involved in the manufacturing company and IT implementation experience of over 12 years.
I have delivered this help to students effortlessly, which is essential to give the students a good grade in their studies.
3.50+
2+ Reviews
10+ Question Solved
Related Book For
Guide To Java A Concise Introduction To Programming
ISBN: 978-3031228414
2nd Edition
Authors: James T. Streib, Takako Soma
Question Posted:
Students also viewed these Computer science questions
-
Briefly describe ASCII and Unicode and draw attention to any relationship between them. [3 marks] (b) Briefly explain what a Reader is in the context of reading characters from data. [3 marks] A...
-
ttth Suppose that the sequence of bags {Bn | n N} is recursively enumerated by the computable function e(n, x) = fn(x), [7 marks] Hence prove that the set of all recursive bags cannot be recursively...
-
ccn2 java solve them all . . . r2 e1 e2 box r2 Write sound typing and subtyping rules for these constructs. [5 marks] Now suppose that we add to this calculus the type variables and bounded universal...
-
At times we can generate a regression equation to explain outcomes. For example, an employees salary can often be explained by their pay grade, appraisal rating, education level, etc. What variables...
-
A vertical cylinder (Fig P4.106) has a 61.18-kg piston locked with a pin trapping 10 L of R-22 at 10C, 90% quality inside. Atmospheric pressure is 100 kPa, and the cylinder cross-sectional area is...
-
Describe a recent tourism service encounter in which a service mistake was handled to your satisfaction or dissatisfaction. What was done, or could have been done, to turn your frown upside down?
-
Generation Ys entitlement mentality. The current workforce is dominated by Generation Ypeople born between 1982 and 1999. These workers have a reputation as having an entitlement mentality (e.g.,...
-
Suppose your friend is thinking of opening a new' restaurant, and she hopes that she will have around 20 groups of (on average) 4 customers on a typical busy evening. Each meal will take around 1.5...
-
On September 1, 2015, Auto Inc. borrows $10,000 to purchase lab equipment, by issuing a 6- month, 4%, note payable. The interest is payable monthly on the first of each month, starting on October 1,...
-
Determine the output from the following code segment: int outer = 1; while (outer < 4) { int inner = 1; while (inner
-
Determine the output from the following code segment: int sum; int count; sum 0; count = 1; while (sum < 10) { } sum sum + count; count++; System.out.println ("sum = System.out.println("count...
-
Define fraud and identify four examples of fraud.
-
how could playing in a sandbox help to the development of children? how could a garden help to the development of children? how could playground obstacle courses like a pebble bridge and monkey bars...
-
A store order bottles of shampoo throughout the year. Over time, the store has learned that the annual demand D for shampoo is constant, i.e., there is no variability. Currently, the store decides to...
-
Solve the Practice #2 == where L2 =02A = a, L404B = c, L = 0204 = d, y = /2 1) Find the velocity 3 when 82 = /2 and 6 = 0.4 rad/s 2) Find the acceleration 63 when = /2 and 62 = 0.4 rad/s 03. 03 Y B...
-
.0.5 0.5 For the above plot of the ellipsoid (22) 2- + +() + (-) = 1, find the parameters a, b and c. Note that a, b and c are positive integers between 1 and 6 inclusive. Use the mouse to rotate the...
-
The annual energy consumption of the University of Maryland is 100 million kWh. How much Uranium-235 is needed to produce this amount of energy in a nuclear power plant assuming 100% efficiency? (The...
-
Find the first three iterations obtained by the Symmetric Power method applied to the following matrices. a. Use x(0) = (1,1, 2)t. b. Use x(0) = (1, 0, 1)t. c. Use x(0) = (0, 1, 0)t. d. Use x(0) =...
-
Difference between truncate & delete
-
Revise the following short and ugly program so that it uses a lambda expression instead of the Adder functor. Dont change sum(). #include #include const int Size = 5; template void sum(std::array a,...
-
Revise the following short program so that it uses a lambda expression instead of f1(). Dont change show2(). #include template void show2(double x, T& fp) {std::cout < < x < < " -> " < < fp(x) < < '...
-
Suppose the Fizzle class has only the data members shown: class Fizzle { private: double bubbles[4000]; ... }; Why would this class not be a good candidate for a user-defined move constructor? What...
-
Create a Data Table to depict the future value when you vary the interest rate and the investment amount. Use the following assumptions: Interest Rates: Investment Amounts:-10.0% $10,000.00 -8.0%...
-
Isaac earns a base salary of $1250 per month and a graduated commission of 0.4% on the first $100,000 of sales, and 0.5% on sales over $100,000. Last month, Isaac's gross salary was $2025. What were...
-
Calculate the price, including both GST and PST, that an individual will pay for a car sold for $26,995.00 in Manitoba. (Assume GST = 5% and PST = 8%) a$29,154.60 b$30,234.40 c$30,504.35 d$28,334.75...
Study smarter with the SolutionInn App