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
​ In addition to analyzing logic and program code, a project team usually holds a session with users, called a _____, to review
andreev551 [17]

Answer:

design walk-through

Explanation:

In addition to analyzing logic and program code, a project team usually holds a session with users, called a <u>design walk-through</u>, to review the interface with a cross-section of people who will work with the new system and ensure that all the necessary features have been included.

A design walk-through is a quality practice that allows designers to obtain an early validation of design decisions related to the development and treatment of content, design of the graphical user interface, and the elements of product functionality.

8 0
3 years ago
What is meant by check digit
Strike441 [17]

Answer:it is the last number in a general digit

Explanation:

6 0
3 years ago
Can anyone tell me what's wrong with my pc. When I turn it on it lights up the ram, motherboard, and fans. The cooler and case f
Mice21 [21]

1 or 2 ways I can try to figure out and see what is causing your computer to do this. 1 when was the last time you shut off  OR was doing on the computer? If your problem gets fixed make sure you close all running apps so the apps don't update while your computer is shutdown. 2 did you or something unplug the cables? Or maybe a virus caused something. Try to unplug every cable and wait about 5-10 minutes and if your computer is still not working, I would advise contacting an administrator.

Hope this helped.

6 0
3 years ago
Which of the following tools is specifically designed to test the dc voltage on a hard disk drive
Leya [2.2K]

Answer:

A power supply tester is specifically designed to test DC voltage on most connectors coming from a PC power supply. A multimeter measures electrical properties such as voltage, amps, and resistance.

7 0
2 years ago
Which option is the easiest way to configure macros in Access 2016?
zhuklara [117]
Number 2
Have a nice day
6 0
3 years ago
Other questions:
  • An electronic resume is a plain-looking document. True of False?
    6·2 answers
  • What is being measured using kbps, mbps, and gbps?
    7·1 answer
  • Consider a Games Expo for Children. Six competitions are laid out for the expo. Tickets are sold according to the age and gender
    11·1 answer
  • @anthonydboss23<br><br> it’s goldielove6 <br><br> .....this is not a question everyone ignore this
    11·2 answers
  • Which paragraph from the article helps explain what “engaged” is referring to?
    9·1 answer
  • The instructions for a computer program are sometimes referred to as . computer programmers focus on computer programs, but they
    5·2 answers
  • How Powerpoint is useful in education aspect?
    5·2 answers
  • What is pseudocode? O A way of describing a set of instructions in text form using plain english O A diagrammatic representation
    13·1 answer
  • Describe the differences and similarities between the most common operating systems used for Mac, PC, and Linux in
    9·1 answer
  • Which of the following best describes a hotspot as
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!