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
Which app is used to synchronize data among iOS devices and Windows desktops?
docker41 [41]
ICloud because it links your old device to the new one
4 0
3 years ago
Read 2 more answers
NO BODY KNOWS! How old is Cynthia Blaise!?
Fiesta28 [93]
I'd guess around 60-70 years possibly 55
3 0
3 years ago
g Write a Racket function (process lst1 lst2) that processes the corresponding elements of the two lists and returns a list. If
blagie [28]

Answer:

  1. def process(lst1, lst2):
  2.    newList = []
  3.    for i in range(0, len(lst1)):
  4.        sum = lst1[i] + lst2[i]
  5.        newList.append(sum)
  6.    return newList
  7. list1 = [1, 3, 5, 7, 9]
  8. list2 = [2, 4, 6, 8, 10]
  9. print(process(list1, list2))

Explanation:

Firstly, create a function process that takes two input lists (Line 1). In the function, create a new list (Line 2). Use a for loop to traverse through the elements of the two lists and total up the corresponding elements and add the sum to the new list (Line 3 - 5). At last, return the new list (Line 6).

In the main program, create two sample list and use them as arguments to test the function process (Line 8 - 9). We shall get the output  [3, 7, 11, 15, 19].

8 0
4 years ago
Which of the following is an output device on an alarm clock?
Dominik [7]

Answer:

the time display

Explanation: because output is somethings thats going on after your don with the input and time display is always on/after an input

6 0
3 years ago
Sarah is working with a team of subject matter experts to diagnose a problem with her system. The experts determine that the pro
sladkih [1.3K]

Answer:

The answer is "Encryption"

Explanation:

Encryption seems to have been established in the new network protocol stack Layer-3 (IPSec) and Layer-4 (SSL, TSL), which enable connectivity across platforms. Currently, network companies allow the sachet-level technologies, that encrypted information and wrong choices can be described as follows:

  • In option a, It uses the application layer to interact with the user to display data and images, that's why it is incorrect.
  • In option c, It is wrong because it is used to store and forward the data.
  • In option d, It is wrong because it is used to start and stop the transmission.
4 0
3 years ago
Other questions:
  • Mark had been a resident of Larchmont for 17 years, and local folks thought of him as a solid citizen. "In this sentence, the wo
    7·2 answers
  • why is it important for young people to start saving early as possible given the principles of interest?
    6·2 answers
  • Application Software include programs like: MS Word, Google Docs, MS Exce ect...
    13·1 answer
  • One vital component of your professional behavior with regard to computing systems today is the creation of​ _________.
    14·1 answer
  • List some good names for devices on your home network or on the network in your school's lab. Demonstrate the use of best practi
    13·1 answer
  • Users report that the network access is slow. After questioning the employees, the network administrator learned that one employ
    7·1 answer
  • What type of backlighting receives dc power directly from a motherboard and doesn't use an inverter?
    11·1 answer
  • LeonRoyal15 if anyone plays fortnite
    10·2 answers
  • How do we store value in a variable? Give an example
    15·1 answer
  • The technologist has recorded the red cell morphology as macrocytic. which mcv value would confirm this observation?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!