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...
-
Terry Toops (Defendant) was convicted in the Cass Superior Court of operating a vehicle while intoxicated, operating a vehicle with 10 percent or more alcohol in the blood, operating a vehicle while...
-
The percentage of the worlds population living in developed countries decreased from 27.1% in 1970 to 19.5% now. Describe changes in which the measurements themselves are percentages. Express each...
-
Ming Company expects to have a cash balance of $46,000 on January 1, 2012. Relevant monthly budget data for the first 2 months of 2012 are as follows. Collections from customers: January $85,000,...
-
Consider a user who needs to transmit 1 . 5 gigabytes of data to a server. The user lives in a small town where only dial - up access is available. A bus visits the small town once a day from the...
-
On January 1, 2022, Jarrison Mining Company purchased a piece of land for mining. The land cost $600,000, including all costs to ready the land for the operation. Jarrison expects 200,000 tons to be...
-
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...
-
Podiatrist Kenneth Krueger was employed by Central Indiana Podiatry, PC (CIP) from 1996 to 2005, under a series of employment agreements that were renewed every year or two. Each agreement restricted...
-
Al Shams Capital group is planning to invest its 1.1 million dirhams in one or more of the following projects. The proposed initial investment and expected net cash flows for each alternative...
-
You own 4 bonds, each with a face value of $1000. These are namely, a 5 year zero coupon bond, a 4 year zero coupon bond, a 4 year bond with a 5% p.a. annual coupon and finally a 5 year bond with a...
-
3. Use this list of Treasury bond prices as of February 15, 2001 to answer the following questions. Coupo n Maturi ty Quote 8s Os 6s 8/15/01 8/15/02 8/15/02 101 91.5 100 10s 2/15/02 ? (a) Derive the...
-
A heat pump delivers 8 kJ thermal energy to the high temperature reservoir at the temperature of 22C (the inside of the house). The outside ambient temperature is -10C. Determine the coefficient of...
-
Problem 3. Find the force (in newtons) exerted by a water molecule (dipole moment P = 6.225-10-30 C-m) on a carbon atom (polarizability a=1.863-10-40 C.m/N) at a distance r = 1 um if the dipole...
-
Reincarnation Bicycle Company manufactures commuter bicycles from recycled materials. The following data for April of the current year are available: Quantity of direct labor used...
-
What can scientists learn by comparing the fossilized skeletons of extinct primates with the bones of modern species?
-
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.
-
Few companies have fans who sleep outside their doors to be the first to purchase their newest products, but this is common at Apple, Inc. In 1997, Apple was on the brink of bankruptcy with a share...
-
Distinguish between traditional, behavioral, and interactionist views of team conflict. How might each explain and deal with an episode of project team conflict?
-
How are need fulfillment and problem-solving selling related and how are they different? Why is this important for selling?
Study smarter with the SolutionInn App