Given the variables String stars = *****; String stripes = =====; what do these loops print? a.
Question:
Given the variables
String stars = "*****";
String stripes = "=====";
what do these loops print?
a. int i = 0;
while (i < 5)
{
System.out.println(stars.substring(0, i));
i++;
}
b. int i = 0;
while (i < 5)
{
System.out.print(stars.substring(0, i));
System.out.println(stripes.substring(i, 5));
i++;
}
c. int i = 0;
while (i < 10)
{
if (i % 2 == 0) { System.out.println(stars); }
else { System.out.println(stripes); }
}
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 16% (6 reviews)
Explantion The given loop runs from i 0 to 4 each time a substring of stars is printed When i is 0 starssubstring0i will be empty string as the start ...View the full answer
Answered By
Antony Mutonga
I am a professional educator and writer with exceptional skills in assisting bloggers and other specializations that necessitate a fantastic writer. One of the most significant parts of being the best is that I have provided excellent service to a large number of clients. With my exceptional abilities, I have amassed a large number of references, allowing me to continue working as a respected and admired writer. As a skilled content writer, I am also a reputable IT writer with the necessary talents to turn papers into exceptional results.
4.50+
2+ Reviews
10+ Question Solved
Related Book For
Question Posted:
Students also viewed these Computer science questions
-
What do these loops print? a. int i = 0; int j = 10; while (i < j) { System.out.println(i + " " + j); i++; j--; } b. int i = 0; int j = 10; while (i < j) { System.out.println(i + j); i++; j++; }
-
What do these loops print? a. for (int i = 1; i < 10; i++) { System.out.print(i + " "); } b. for (int i = 1; i < 10; i += 2) { System.out.print(i + " "); } c. for (int i = 10; i > 1; i--) {...
-
Activity Optimistic Time Estimate (weeks) Most Likely Time Estimates (weeks) Pessimistic Time Estimates (weeks) Immediate Predecessor(s) A 3 5 10 none B 3 5 9 A C 5 7 13 A D 4 5 12 B E 5 11 16 C F 3...
-
Carlberg Company has two manufacturing departments, Assembly and Painting. The Assembly department started 11,000 units during November. The following production activity in both units and costs...
-
The length of a particular telemarketing phone call, x, has an exponential distribution with mean equal to 1.5 minutes. a. Write the formula for the exponential probability curve of x. b Sketch the...
-
Redo Problem 16.16 using Eqs. (16.52) and (16.56) to determine the magnitude and location of the active thrust on the wall. Problem 16.16 Refer to Figure 16.17. Given H = 6 m, = 18.5 kN/m 3 , ' =...
-
If, unlike a perfectly competitive employer, a monopsonist has to pay a higher wage to attract more workers, whywill a monopsonist pay a lower wage than a perfectly competitive employer?
-
1. On January 1, 2012, Microsport, Inc., purchased $120,000 face value of the 9% bonds of Service Express, Inc., at 104. The bonds mature on January 1, 2017. For the year ended December 31, 2015,...
-
3. Which type of deed provides the grantee with the HIGHEST level of protection?
-
1. Take a look at the information about your line of best fit. What quantity does the y represent in this experiment? Mass Curve: VF Az + B A: 1.369 + 0.06221 B: 81.31 +3.958 g RMSE : 4.385 g Hint:...
-
Write programs with loops that compute a. The sum of all even numbers between 2 and 100 (inclusive). b. The sum of all squares between 1 and 100 (inclusive). c. All powers of 2 from 20 up to 220. d....
-
Write programs that read a sequence of integer inputs and print a. The smallest and largest of the inputs. b. The number of even and odd inputs. c. Cumulative totals. For example, if the input is 1 7...
-
Linkin Corporation is considering purchasing a new delivery truck. The truck has many advantages over the company's current truck (not the least of which is that it runs). The new truck would cost...
-
1.how has economics been used to help managers solve organizational problems and structure more effective organizational structures. 2.how has the concept of "Economic Darwinism" have implications...
-
A wood frame wall consists of 2x6 wood studs (38mm x 140mm)spaced at 16? o.c. (on centre), with fibreglass batt insulation(see ?insulating blankets and batts in Tbl. 8.1) between the studs.Each stud...
-
If college degrees are actually required to have a decent job, why aren't more employers, or even the government, doing more to reduce the overwhelming number of students with heavy debt? And give me...
-
Farmers in New Zealand wake at 5 AM to work hard in their fields growing kiwi because: they have an absolute advantage in the production of kiwi. the value to them of their time and other resources...
-
Why are global value chains so important to emerging markets and their development? Select two GVCs, and discuss to what extent emerging market firms and governments can respond to the opportunities...
-
A double-stranded DNA molecule is 1 cm long, and the percentage of adenine is 15%. How many cytosines would be found in this DNA molecule?
-
Proposals have been made to ?sail? spacecraft to the outer solar system using the pressure of sunlight, or even to propel interstellar spacecraft with high-powered, Earth-based lasers. Sailing...
-
Distinguish between synchronous and statistical TDM.
-
Four channels, two with a bit rate of 200 kbps and two with a bit rate of 150 kbps, are to be multiplexed using multiple-slot TDM with no synchronization bits. Answer the following questions: a. What...
-
Distinguish between multilevel TDM, multiple-slot TDM, and pulse-stuffed TDM.
-
Dr. Kelly has a podiatry practice with total assets valued at $900,000. The liabilities of the business total $500,000. What is Dr. Kelly's podiatry practice's net worth?
-
Daniel is buying Therese's condo with a conventional mortgage. Prior to settlement, both Daniel and Therese will receive settlement statements detailing their closing costs. Who will provide these to...
-
What is the importance of preventive maintenance in infrastructure?
Study smarter with the SolutionInn App