1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Eva8 [605]
3 years ago
12

Define a function that takes two arguments: a string called strText and a number called intNumber. This function will use a repe

tition structure (a While or For loop) to print strText intNumber of times. Call this function.
Computers and Technology
2 answers:
galben [10]3 years ago
6 0
<h2>Answer:</h2>

// Class declaration

public class Printer {  

   // Define the function and call it printMany

   // The return type is void since it doesn't necessarily return any value.

   // It just prints to the console.

   // It takes two arguments strText of type String and

   // intNumber of type int.

  public static void printMany(String strText, int intNumber){          

       // Initialize the loop counter i to 1;

       int i = 1;

      // Create a while loop that goes

      // from <em>i = 1</em> to  <em>i = intNumber</em>.

      // Where intNumber is the number of times the string strText

      // will be printed.

      while(i <= intNumber) {

           

            // At each of the cycle of the loop;

           // print out the string strText

           // and increment the value of the loop counter by 1

           System.out.println(strText);

           i++;

       }                 // End of while loop

   }               // End of method, printMany, declaration

// Write the main method to call the printMany function

public static void main(String[] args) {

       // Call the printMany function by supplying sample arguments;

       // In this case, strText has been given a value of "Omobowale"

       // And intNumber has been given a value of 4

       // Therefore, "Omobowale" will be printed 4 times.

       printMany("Omobowale", 4);

   }            //  End of main method

}          // End of class declaration

<h2>Sample Output: </h2>

<em>When the program above is run, the following will be the output;</em>

<em>----------------------------------------------------</em>

Omobowale

Omobowale

Omobowale

Omobowale

-------------------------------------------------------

<h2>Explanation:</h2>

Comments:

* The above code has been written in Java

* The code contains comments explaining every part of the code. Kindly go through the comments.

The whole code without comments is re-written as follows;

public class Printer {      

   public static void printMany(String strText, int intNumber){    

       int i = 1;

       while(i <= intNumber){

           System.out.println(strText);

           i++;

       }

   }      

   public static void main(String[] args) {

       printMany("Omobowale", 4);

   }

}

natima [27]3 years ago
3 0

Answer:

public class Main

{

   public static void printString(String strText, int intNumber) {

       for(int i=0; i<intNumber; i++){

           System.out.println(strText);

       }

   }

   

public static void main(String[] args) {

       

       printString("Brainly", 3);

}

}

Explanation:

- Define a function called <em>printString</em> that takes two parameters - a String and an int. Since the function will print out the given String, it's type will be <u>void</u>.

- Use <em>for loop</em> to iterate according to the given number and print the given string

- In the main, call the <em>printString </em>function with some parameters.

You might be interested in
What is a correlation and how does it relate to inferential error?
riadik2000 [5.3K]
A correlation is a consistent relationship between two or more variables. It relates to our tendency to draw causation from mere correlation.
5 0
3 years ago
Based on the following passage on construction technology during the Middle Ages, why might a worker not be allowed to join a gu
olya-2409 [2.1K]

Answer:

He was not born into a family of skilled laborers

Explanation:

6 0
3 years ago
Explain the working system of computer systems with examples​
geniusboy [140]

,I don't know you all about computer

8 0
3 years ago
How long is the bachelor's program at Eth Zurich? 3 or 4 years?
natulia [17]
The bachelor's program at Eth Zurich is 3 years.
I hope this helps!
:-)
4 0
3 years ago
Intel® Core™ i5-7500 is one of Intel's 7th generation of microprocessors and was launched earlier in 2017 and has been used in m
Ket [755]

Answer:

A. 4 CPUs and 6 megabyte cache memory

B. 1.3157 x10^-9 nanoseconds

Explanation:

The Intel core i5 7500 is a seventh generation central processing unit with a 4 CPU core and a 6 megabyte cache memory. It executes task at a clock cycle of 5 clock cycle at a speed of 3.8 GHz.

The relationship between frequency and clock cycle is,

Clock cycle = 1 / ( frequent).

So, One clock cycle = 1 / 3.8 GHz

= 0.3 x10^-9

For five clock cycles = 5 x 0.3 x10^-9

= 1.3157 x10^-9 nanoseconds.

5 0
3 years ago
Other questions:
  • Discuss the types of data that business might collect and how the business could use that data to drive decision-making in a spe
    15·1 answer
  • These items describe guidelines for the effective use of presentation graphics. Graphics should be large enough to be seen by th
    9·1 answer
  • Amy just added a 462 meter run of fiber optic cable to the network what should she do next?
    10·1 answer
  • Interactive sites where users write about personal topic and comment to threaded discussion are called?
    10·2 answers
  • What term refers to the text label that describes each data series?
    9·1 answer
  • In which client/server relationship can a computer act as both a client AND a server? Select one: a. X-Windows b. SSH c. Classic
    8·1 answer
  • What keyboard functions lets you delete words
    15·2 answers
  • Which web browser was created by Google?
    5·2 answers
  • How can you say that a painting is real? ​
    7·2 answers
  • 100POINTS!!!!!!!!!!!!!!!!!!!I WILL ANSWER ALL OF YOUR QUESTIONS PLEASE LOVES:)))Upload your completed project including the foll
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!