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
Have fire have ....<br><br>babi​ from babi098
Genrish500 [490]

Answer:

yessss I tooo have a fire at my home

lolololololololololo

ok have a great day what is your name ?

4 0
2 years ago
Define a function print_feet_inch_short(), with parameters num_feet and num_inches, that prints using ' and " shorthand. End wit
Crazy boy [7]

def print_feet_inch_short(num_feet, num_inches):

#function named print_feet_inch_short takes in two arguments.

print(str(num_feet)+"'",str(num_inches)+"\"")

#output the feet and inch value supplied with the shorthand sign of feet and inch using string concatenation.

num_feet = int(input())

#allows user to specify a feet value and stores it in num_feet

num_inches = int(input())

#allows user to specify an inch value and stores it in num_inch

print_feet_inch_short(num_feet, num_inches)

#calling the function with the number of feets and inches given by user.

Learn more : brainly.com/question/18318709

4 0
2 years ago
Read 2 more answers
Which of the following changes the features (e.g., thickness of the line, shadow, 3-D effect, single or double, etc.) of the bor
lilavasa [31]
Border style
I hope it’s work
8 0
3 years ago
Write a function that takes a list as a parameter, converts every element in the list to integar and then returns a tuple compri
abruzzese [7]

Answer:

Following is given the solution of your question as required.

All the necessary descriptions are given in form of comments,

Sample output are also shown.

I hope it will help you!

Explanation:

6 0
2 years ago
Name at least TWO kinds of gaming experiences that are possible with these new control devices but were not possible on original
Pie

Yes the ansewer is c bc you can look it up!


6 0
2 years ago
Other questions:
  • Achieving a degree in computer forensics, information technology, or even information systems can provide a strong foundation in
    11·1 answer
  • Which of the following is important to do when downloading a game to your
    8·1 answer
  • The following method public String removeFromString(String old, String frag) removes all occurences of the string frag from the
    12·1 answer
  • Type the correct answer in the box.
    15·1 answer
  • What cannot be performed using windows task manager
    10·1 answer
  • How might the website owner use theses details other than to verify login details?
    6·2 answers
  • It is possible to limit the search results to a range of publication dates.
    13·1 answer
  • What blockchain implementation resulted from bitcoin’s rejection of a recommendation to enhance its scripting language support?
    9·1 answer
  • What is the output of the following program?
    8·1 answer
  • You use lpstat and determine that a user named User1 has placed two large print jobs in the queue for Printer1 that have yet to
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!