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 type of backlighting receives dc power directly from a motherboard and doesn't use an inverter?
LenaWriter [7]
The answwer to the type of hardware is led lighting it does not need a inverter
3 0
3 years ago
Which of the following solutions should an administrator use to reduce the risk from an unknown vulnerability in a third-party s
ser-zykov [4K]

Answer:

A. Sandboxing

Explanation:

The best solution to apply for this task would be Sandboxing. This is a software management strategy that isolates applications from critical system resources and other programs. In doing so you effectively add a secondary security layer on top of the application in order to prevent any and all malware from entering and damaging your overall system. Thus effectively reducing the risk.

4 0
3 years ago
2.<br> Fill in the blanks:<br> a) Software is a set of computer program
scoray [572]

Answer:

Software is a set of computer programs which makes computer work.

4 0
3 years ago
"abstraction" is often used to focus on a general case and ignore a specific instance of a problem. Given this meaning of the wo
prisoha [69]

Answer:

Abstraction is the process of removing or taking away certain characteristics to reduce or hide several very important characteristics.

In OOP (Object Oriented Programming), to increase efficiency and reduce complexity, a programmer hides certain vital data about an object. This is abstraction in programming.

For further clarification, a programmer ensures that the name given to an entity makes sense and most importantly, that it carries relevant aspects, and non essential parts are not included.

3 0
3 years ago
The sections that should be included in your research paper are the _____.
Fiesta28 [93]

Thesis

Intro

Body

Conclusion

5 0
3 years ago
Other questions:
  • What identifies available computers through the internet?
    14·1 answer
  • 1. Which sign-in method requires users to press Ctrl+Alt+Delete before signing in?
    5·1 answer
  • \What will the weather most likely be like the day after a warm front? (4 points) The temperature will be cool or cold, and ther
    7·2 answers
  • In Windows Vista, the Run command can be found in which application?
    6·1 answer
  • Why are specification for food processing tool,equipmentand untensils necessary?​
    8·1 answer
  • Which of the following are not deducted on a typical pay stub
    12·1 answer
  • Help with this please anyone
    15·2 answers
  • You can fit more RAW files on a memory card than JPEG files. true or false
    10·1 answer
  • Why can't this app have people ask riddles.
    8·1 answer
  • How do you stop getting emails from brainly saying "sarah from brainly has answered your question"
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!