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
I need like 10 sentences to delineate and discuss societal issues related to computing . “Including the guiding principles of pr
beks73 [17]

Answer:

Kindly check Explanation

Explanation:

Advancement in technology spurred largely due to the advent of the computer and internet has resulted in a notable change in the behavior, lifestyle and engagement of many individuals. This include ; providing a faster and more convenient way of computing and completing tasks. Accelerating the global rate of technological development due to great computing capabilities. Educational enhancement and development through online education.

Computing also pose some societal issues which needs to addressed. This include :

Issues regarding privacy and identity theft are widespread. Addiction to games and other engaging content often pose distraction to youth and child development. Computing could be said to have placed increased pressure on human power and engagement with the advent of automated robots and programs. Increased exposure to electromagnetic rays. Promotion of indecency and immoral contents has become increasingly easier. Peer influence through fake promotion and display of wealth by some overrated individuals.

Therefore, it is imperative that informations conveyed through the internet are treated with utmost confidentiality in other to avoid privacy issues which may arise from leakage.

8 0
4 years ago
Somehow I lost 1000 points!!! Does anyone know what happened? Is it possible that I was hacked? ​
Dima020 [189]

Answer:

Explanation:

You most likely lost 1000 points because you cheated to get them if not there is a possibility you were.

6 0
3 years ago
Read 2 more answers
If you can tell me what the best part about black ops 2 is and get it right you can have the Brainliest
Maru [420]
The best part about Bo2 is the zombies, hands down. ^
4 0
4 years ago
Read 2 more answers
Billy needs to type a bibliography/reference page for the report that he just typed. Which paragraph format should he use?
Olin [163]
He should use a MLA format

3 0
3 years ago
Ugh these are hard questions
SVEN [57.7K]
9 is B, and 10 is D I think ... brainliest pls
8 0
3 years ago
Other questions:
  • you just bought a new hard drive for your computer to be used as a secondary hard drive to store all your files after installing
    5·1 answer
  • What are some causes of the number of bytes on the wire exceeding the number of bytes being captured?
    6·2 answers
  • Which of the following is true about images that are arranged in a collumn
    9·1 answer
  • 1. Write a program that grades arithmetic quizzes as follows: (4 points) a. Assume there are 23 questions in the quiz. b. Ask th
    10·1 answer
  • The advantage of returning a structure type from a function when compared to returning a fundamental type is that
    5·1 answer
  • You’re dying to see the flaming eyelashes in concert this summer what’s the best way to cop a few tickets
    6·1 answer
  • A computer that connects to a powerful computer on a network is called a ______. boss client kid server
    8·2 answers
  • In which situation is coauthoring of presentations primarily utilized?
    9·1 answer
  • Enthusiasm codehs 7.6.4 Write a function called add_enthusiasm that takes a string and returns that string in all uppercase with
    15·1 answer
  • Write a method that draws a circle and a square that is centered in a DrawingPanel. The method will take in the width and height
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!