Examlex

Solved

Programming Write a Static Method Named Cheerleader That Accepts Two Integer

question 7

Essay

Programming
Write a static method named cheerleader that accepts two integer parameters lines and cheers and prints a series of "cheer" lines at increasing levels of indentation. The first parameter represents the number of lines of output to print, and the second represents the number of "cheers" per line. For example, the call of cheerleader(2, 4) means that you should print 2 lines of output, each containing 4 "cheers." A "cheer" is an occurrence of the word "Go" in the output. Neighboring cheers are separated by the word "Team", so 1 cheer is printed as "Go", 2 cheers as "Go Team Go", 3 cheers are printed as "Go Team Go Team Go", and so on.
The lines you print should be displayed at increasing levels of indentation. The first line displayed should have no indentation, but each following line should be intended by 3 spaces more than the one before it. In other words, the 2nd line of output should be indented by 3 spaces, the 3rd line by 6 spaces, and so on.
You may assume that both parameters passed your method will have values of at least 1.
The following calls demonstrate your method's behavior. Your method should match this output format exactly:
Programming Write a static method named cheerleader that accepts two integer parameters lines and cheers and prints a series of  cheer  lines at increasing levels of indentation. The first parameter represents the number of lines of output to print, and the second represents the number of  cheers  per line. For example, the call of cheerleader(2, 4) means that you should print 2 lines of output, each containing 4  cheers.  A  cheer  is an occurrence of the word  Go  in the output. Neighboring cheers are separated by the word  Team , so 1 cheer is printed as  Go , 2 cheers as  Go Team Go , 3 cheers are printed as  Go Team Go Team Go , and so on. The lines you print should be displayed at increasing levels of indentation. The first line displayed should have no indentation, but each following line should be intended by 3 spaces more than the one before it. In other words, the 2<sup>nd</sup> line of output should be indented by 3 spaces, the 3<sup>rd</sup> line by 6 spaces, and so on. You may assume that both parameters passed your method will have values of at least 1. The following calls demonstrate your method's behavior. Your method should match this output format exactly:


Definitions:

Permeability

The ability of a material, such as rock or soil, to allow fluids to pass through it, often measured in terms of the ease with which water can flow.

Porosity

The measure of a rock's ability to hold water, determined by the volume of voids or spaces within the rock.

Artesian Aquifer

A confined aquifer containing groundwater under positive pressure, causing water to rise above the surrounding water table when tapped.

Confined Aquifer

A confined aquifer is a water-bearing stratum of permeable rock, sand, or gravel that is trapped between layers of impermeable rock and is under pressure.

Related Questions