Define a function that takes two arguments: a string called strText and a number called intNumber. This function will use a repetition structure (a While or For loop) to print strText intNumber of times. Call this function.

Answers

Answer 1
Answer:

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 printString that takes two parameters - a String and an int. Since the function will print out the given String, it's type will be void.

- Use for loop to iterate according to the given number and print the given string

- In the main, call the printString function with some parameters.

Answer 2
Answer:

Answer:

// 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 i = 1 to  i = intNumber.

      // 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

Sample Output:

When the program above is run, the following will be the output;

----------------------------------------------------

Omobowale

Omobowale

Omobowale

Omobowale

-------------------------------------------------------

Explanation:

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);

   }

}


Related Questions

. In Stack we can access elements from both endso Trueo False
An attempt to generate a large number of session IDs and have a server process them as part of a session hijack attempt is known as what type of attack
How does an Index Organized table differ from a standard table and a typical index?
Which items are placed at the end of adocumentO HeaderO FooterO Foot NoteO End note​
Laptop components that can be replaced relatively easily include the ____ and the ____first partscreen power supplyRAM second part hard diskkeyboard touchpad​

Write a program to calculate how much to tip a waiter person based on the quality of service. The script file should ask for the amount of the check and whether the service was good, fair or poor. If the service was good, the tip should be 20%. If the service was fair, the tip should be 15%. If the service was poor, the tip should be 5%. The program should display the tip and the total of the check including the tip.

Answers

Answer:

Since Python is a scripting language, here is code in python.

#prompt user to give check

amount=float(input("Please Enter the check:"))

#prompt user to give service

service=input("Please Enter the service (good, fair or poor):")

# calculate tip on the basis of service

if service =="good":

   tip=amount*0.2

elif service=="fair":

   tip=amount*0.15

elif service=="poor":

   tip=amount*0.05

#calculate total

total=amount+tip

#print tip

print("tip is equal to : {} ".format(tip))

#print total

print("total of the check is : {} ".format(total))

Explanation:

Prompt user to give check and service input.After taking the input from user, based on the service tip will be calculated. if service is "good" then tip will be 20% of the check, tip will be 15% if service is "fair" and tip will be 5% if service is "poor".

Output:

Please Enter the check:125                                                                                                

Please Enter the service (good, fair or poor):good                                                                        

tip is equal to : 25.0                                                                                                    

total of the check is : 150.0

In this project you will write a set of instructions (algorithm). The two grids below have colored boxes in different locations. You will create instructions to move the colored boxes in grid one to their final location in grid two. Use the
example to help you. The algorithm that you will write should be in everyday language
(no pseudocode or programming language). Write your instructions at the bottom of the
page.
Example: 1. Move
the orange box 2
spaces to the right.
2. Move the green
box one space
down. 3. Move the
green box two
spaces to the left.
Write your instructions. Review the rubric to check your final work.
Rules: All 6 colors (red, green, yellow, pink, blue, purple) must be move to their new location on the grid. Block spaces are
barriers. You cannot move through them or on them – you must move around them

Answers

Answer:

Explanation:

Pink: Down 5 then left 2.

Yellow: Left 3 and down 2.

Green: Right 7, down 4 and left 1.

Purple: Up 6 and left 9.

Red: Left 7, down 5 and left 1.

You can do the last one, blue :)

Answer:

Explanation:

u=up, d=down, r=right, l=left

yellow: l3d2

pink: d5l2

green: r7d4l1

purple: u6l9

red: l7d5l1

blue: r2u7l5

If you need speeds of 16 Mbps between two corporate sites in the United States, you would need a ________ leased line. T1 T3 OC3 None of these

Answers

Answer:

T3.

Explanation:

A T3 is an acronym for Transmission system 3 and it is also known as Digital Signal Level 3 (DS3). T3 is a point-to-point physical circuit connection which is capable of transmitting up to 44.736Mbps.

This simply means that, when using a Transmission system 3 (T3), it is very much possible or easier to transmit data such as video and audio at the rate of 44.736Mbps.

Please note, Mbps represents megabit per seconds and it is a unit for the measurement of data transmission rate. The Transmission system 3 is an internet connection that has up to 672 circuit channels having 64Kbs.

Also, worthy of note is the fact that a T3 line is made up of twenty-eight (28) Transmission system 1 lines (T1) each having a data transfer rate of 1.544Mbps.

Additionally, Transmission 3 lines are symmetrical and duplex and thus, has equal upload and download speeds. Therefore, transmissions can be done on T3 lines simultaneously without the data lines being clogged or jammed.

If you need speeds of 16 Mbps between two corporate sites in the United States, you would need a T3 leased line.

Generally, the T3 lines are mostly used for multichannel applications and uninterrupted high bandwidth consumptions such as Telemedicine, internet telephony, video conferencing, e-commerce etc.

Consider the following two code segments, which are both intended to determine the longest of the three strings "pea", "pear", and "pearl" that occur in String str. For example, if str has the value "the pear in the bowl", the code segments should both print "pear" and if str has the value "the pea and the pearl", the code segments should both print "pearl". Assume that str contains at least one instance of "pea".I.

if (str.indexOf("pea") >= 0)

{

System.out.println("pea");

}

else if (str.indexOf("pear") >= 0)

{

System.out.println("pear");

}

else if (str.indexOf("pearl") >= 0)

{

System.out.println("pearl");

}

II.

if (str.indexOf("pearl") >= 0)

{

System.out.println("pearl");

}

else if (str.indexOf("pear") >= 0)

{

System.out.println("pear");

}

else if (str.indexOf("pea") >= 0)

{

System.out.println("pea");

}

Which of the following best describes the output produced by code segment I and code segment II?

Both code segment I and code segment II produce correct output for all values of str.

Neither code segment I nor code segment II produce correct output for all values of str.

Code segment II produces correct output for all values of str, but code segment I produces correct output only for values of str that contain "pear" but not "pearl".

Code segment II produces correct output for all values of str, but code segment I produces correct output only for values of str that contain "pearl".

Code segment II produces correct output for all values of str, but code segment I produces correct output only for values of str that contain "pea" but not "pear".

Answers

Answer:

Code segment II produces correct output for all values of str, but code segment I produces correct output only for values of str that contain "pea" but not "pear".

Explanation:

The main issue with the first code segment is the way how the if else if condition are arranged. The "pea" is checked at the earliest time in the first code segment and therefore so long as there is the "pea" exist in the string (regardless there is pear or pearl exist in the string as well), the if condition will become true and display "pea" to terminal. This is the reason why the code segment 1 only work for the values of str that contain "pea".

Describe how the Internet Protocol (IP) allows devices to easily connect and communicate on the Internet.

Answers

Internet Protocol (IP) are guideline about how data should be sent across the internet.

Internet Protocol (IP) work hand in hand with packet as they are connected to every packet which therefore means that any internet users who connect to the internet will be allocated with a unique Internet Protocol (IP)  address.

This  Internet Protocol (IP)  address will  enables the user devices to connect and communicate across the internet with ease once the packets are connected to the each Internet Protocol (IP)  address allocated to them.

Learn more here:

brainly.com/question/23954744

Convert the binary number into a hexadecimal number.

Answers

Explanation:

A binary number is converted to hexadecimal number by making a group of 4 bits from the binary number given.Start making the group from Least Significant Bit (LSB) and start making group of 4 to Most Significant (MSB) or move in outward direction.If the there are less than 4 bits in last group then add corresponding zeroes to the front and find the corresponding hexadecimal number according to the 4 bits.For example:-

for this binary number 100111001011011.

100  11100101  1011

There is one bits less in the last group so add 1 zero(0) to it.

0100  1110  0101  1011

  4        E        5        B

100111001011011 = 4E5B

101011.1010

0010   1011  .   1010

  2          B           A

=2B.A