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
Katarina [22]
3 years ago
9

Fill in this function that takes three parameters, two Strings and an int. 4- // Write some test function calls here! The String

s are the message that should be printed. You should alternate printMessage("Hi", "Karel", 5); between the Strings after each line. The int represents the total number of lines that should be printed. public void printMessage(String lineOne, String lineTwo, in For example, if you were to call 19.
printMessage("Hi", "Karel", 5);
// Start here! 12 the function should produce the following output:
Hi
Karel
Hi
Kare
Computers and Technology
1 answer:
zimovet [89]3 years ago
8 0

Answer:

The function in Java is as follows:

public static void printMessage(String lineOne, String lineTwo, int lines){

       for(int i = 1;i<=lines;i++){

           if(i%2 == 1){

               System.out.println(lineOne);

           }

           else{

               System.out.println(lineTwo);

           }

       }

   }

Explanation:

This defines the function

public static void printMessage(String lineOne, String lineTwo, int lines){

This iterates through the number of lines

       for(int i = 1;i<=lines;i++){

String lineOne is printed on odd lines i.e. 1,3,5....

      if(i%2 == 1){

               System.out.println(lineOne);

           }

String lineTwo is printed on even lines i.e. 2,4,6....

           else{

               System.out.println(lineTwo);

           }

       }

   }

To call the function from main, use:

printMessage("Hi", "Karel", 5);

You might be interested in
Alice sends a message to Bob in a manner such that Bob is the only person who can tell what the real message is. Which security
cupoosta [38]

Answer:

confidentiality

Explanation:

Alice sends a message to Bob in a manner such that Bob is the only person who can tell what the real message is. Which security concept is this an example of

3 0
3 years ago
What type of lens was used to take this picture?
Leona [35]

Fish-eye because this is how you would see through a "fish eye" point of view in a rounded tank that is commonly used.

May I please have brainliest

4 0
4 years ago
What effect would excluding quotation marks from a search phrase have?
n200080 [17]

Answer: C

 it would broaden the search

Explanation:

Placing quotation marks around a search term or phrase limits your search to that exact term or phrase. Without the quotes, your search engine may return all results that contain each separate word. Placing AND between your keywords will return results that only include both or all your keywords.

4 0
3 years ago
¿El auto es un servicio tecnológico? / The car is a technological service?
EleoNora [17]
A car isn’t technological, It runs on gas. Hopes this helps :p
4 0
3 years ago
Arrays save space because all elements of an array are stored in a single memory location while a list of variables needs a sepa
Nataly_w [17]

Answer:

Option A. True Is the correct answer

Explanation:

Arrays are allowed to store multiple elements of the same data type, all of them stored with the same array hence preventing the need for creating separate variables for each element. An array therefore will act as a container for storing several variables all of the same type. This offers a lot of convinience and enhances better memory space management. In java arrays are declared by:

dataType[] arrayName;

Where dataType is the datatype of elements to be stored in the arrays. This is followed by a pair of square brackets then the name of the array.

for declaration and initialization in Java, the new keyword is used as:

dataType[] arrayName = new dataType[arraySize];

8 0
3 years ago
Other questions:
  • The media should be encouraged to speak with everyone at the POD site.<br> a. True<br> B. False
    6·1 answer
  • Write a program to calculate student's average test scores and the grade. You may assume the following input data:
    9·1 answer
  • An array of Strings, names, has been declared and initialized. Write the statements needed to determine whether any of the array
    9·1 answer
  • Uuhdcnkhbbbbhbnbbbbnnnnnnnnnfddjkjfs
    14·1 answer
  • What is word wrapping??
    5·1 answer
  • Qwertyuytrefgvbhnjkmjhgfvbnmjkuhytgfvbnmjkuyhgnjmkiuyhgbnmkloi<br><br> type pig latin now . . .
    14·2 answers
  • Answer to this problem
    11·1 answer
  • Made from fruit juice, water and sugar, The American version contains milk and cream and sometimes egg white​
    9·1 answer
  • 1) Given what you have learned about computers and information technology thus
    6·1 answer
  • Only people who have nitrotype answer this question!!!
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!