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
Brrunno [24]
3 years ago
7

Write your own printArray() function found in Processing for the Arduino. For simplicity, you can limit printArray() to integer

arrays and you will also pass the size of the array to your function. For example, given the following code:
int terps[5] = {7, 9, 12, 1, 46};
void printArray(int arrayToPrint[], int arraySize) { // YOUR CODE HERE }
void setup()
{ // put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
printArray(terps,sizeof(terps)/sizeof(int)); delay(1000);
}

You should repeatedly see the following in the serial monitor:

[0]: 7
[1]: 9
[2]: 12
[3]: 1
[4]: 46
Computers and Technology
1 answer:
VLD [36.1K]3 years ago
6 0

Answer:

Follows are the method definition to this question:

void printArray(int arrayToPrint[], int arraySize) //defining a method printArray that accepts two array in its parameters

{

for (int j = 0; j < arraySize; j++)//defining for loop print Serial numbers

{

Serial.print("[");//use print method to print square bracket

Serial.print(j);//use print method to print Serial numbers

Serial.print("]: ");//use print method to print square bracket

Serial.println(arrayToPrint[j]);//printing array value

}

}

Explanation:

In the above code, a method "printArray" is declared that holds two arrays "arrayToPrint and arraySize" as a parameter, and inside the method is used for loop to print the values.

In the loop, first, it uses the square bracket to print the serial number and in the last step, it prints array values.

You might be interested in
Write the WordSandwich method allSandwiches. This method creates and returns a new array of String objects as follows. Each elem
nalin [4]

Answer:

import java.util.*;

class Main

{

private String[] totalSandwiches(String string1,String string2)

{

int totalElements = string1.length()-1;

String ans[] = new String[totalElements];

for(int i=0;i<totalElements;i++)

{

String temp = "";

for(int j=0;j<=i;j++)

{

temp+=string1.charAt(j);

}

temp+=string2;

for(int j=i+1;j<string1.length();j++)

{

temp+=string1.charAt(j);

}

ans[i] = temp;

}

return ans;

}

public static void main(String[] args)

{

Scanner sc = new Scanner(System.in);

Main obj = new Main();

String string1,string2;

System.out.print("Enter the 1st String: ");

string1 = sc.nextLine();

while(string1.length()<2)

{

System.out.print("The size of string 1 should be atleast 2 to make a sandwich. Enter the string again: ");

string1 = sc.nextLine();

}

System.out.print("Enter the 2nd String: ");

string2 = sc.nextLine();

while(string2.length()==0)

{

System.out.print("The size of string 2 should be atleast 1 to make a sandwich. Enter the string again: ");

string2 = sc.nextLine();

}

System.out.println("Following are the sandwiches: ");

String ans[] = obj.totalSandwiches(string1,string2);

for(int i=0;i<ans.length;i++)

{

System.out.println(ans[i]);

}

}

}

Explanation:

  • Run a while loop upto the total no. of elements and calculate number of elements from the string1 that should come before string2 .
  • Append the remaining characters of string1 are to temp.
  • The ans array stores the temp at ith index.
  • string1 characters are stored by the variable j.
  • Sandwich is not possible if string1 has less than 2 elements and possible if string2 has no elements.
  • Finally display the sandwich strings.
5 0
3 years ago
Explain one way in which programmers may get hired.
ryzh [129]

Explanation:

I think you first get interviewed?

Then you get like a test and then have to explain it to the admission people on a whiteboard or something.

8 0
3 years ago
Assume that the message M has to be transmitted. Given the generator function G for the CRC scheme, calculate CRC. What will be
ANEK [815]

Let the message be M : 1001 0001   and the generator function is G : 1001

Solution :

CRC sender

            <u>                                     </u>

1001     | 1001  0001  000

           <u>  1001                             </u>

           <u> 0000  0001             </u>

                        1000

            <u>            1001             </u>

                        0001  000

                             <u>    1 001  </u>

                                 0001

Here the generator is 4 bit - 1, so we have to take three 0's which will be replaced by reminder before sending to received--

eg    1001  0001  001    

Now CRC receiver

                <u>                                     </u>

1001         | 1001    0001   001

                <u> 1001                           </u>

                 0000 0001

                       <u>     1001                  </u>

                            1000

                          <u>  1001              </u>

                            0001  001

                    <u>        0001  001      </u>

                                   0000

No error

7 0
3 years ago
Which of the following provides services to hosts on its network?
Nina [5.8K]

Answer:

Server

Explanation:

a computer or computer program which manages access to a centralized resource or service in a network.

3 0
3 years ago
2. What does the Action tool allow you to do in Microsoft PowerPoint? (20 points)
creativ13 [48]
B. Add actions

A. a presentation without a clear beginign middle and end

A. add action between slides
7 0
3 years ago
Read 2 more answers
Other questions:
  • The rod and crankshaft convert the up-and-down motion of the piston into
    12·2 answers
  • Bullets in a text box will do which of the following?
    9·2 answers
  • How can i complain a rude comment
    7·1 answer
  • Two technicians are discussing a resistance measurement. Technician A states that components being measured should be removed or
    10·1 answer
  • ABC software company is to develop software for effective counseling for allotment of engineering seats for students with high s
    13·1 answer
  • Task 2: Typing a School Speech
    12·1 answer
  • How do you enter the decimal 73 into the computer?
    11·1 answer
  • An application's certificate indicates the application -
    5·1 answer
  • 2. How much did John Jones have in his account on the first day of the
    5·1 answer
  • Complete the sentence.
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!