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
yan [13]
2 years ago
8

how do you call the squares method to compute the first five squares and store the result in an array numbers

Computers and Technology
1 answer:
IRINA_888 [86]2 years ago
8 0

Answer:

The method can be called using:

int[] returnarray = Squares();

<em>Where returnarray represents the name of the array</em>

Explanation:

To answer this, I will make an assumption that the Square method is an int array method (i.e. it returns array).

So, to call the method from main, an array has to be declared to get the values:

int[] returnarray = Squares();

Then an iteration is created to iterate through the array in order to print the array elements.

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

 System.out.print(returnarray[i]+ " ");    

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

The answer ends here

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

As an addition, the complete program that includes the method and the main is:

<em>public class Main{</em>

<em> public static int [] Squares(){</em>

<em>     int [] arr = new int[5]; </em>

<em>     for(int i = 1;i<6;i++){</em>

<em>         arr[i-1] = i*i;</em>

<em>     }</em>

<em>     return arr;</em>

<em> }</em>

<em> public static void main(String[] args) {</em>

<em>  int[] returnarray = Squares();</em>

<em>  for (int i = 0; i < returnarray.length; i++)</em>

<em>  System.out.print(returnarray[i]+ " ");          </em>

<em> }  </em>

<em>}</em>

You might be interested in
You notice that somehow you have duplicate records for some of your clients in your database. What should you do?
IRINA_888 [86]

Inspect them and make sure that they are exact copies then delete one if they are the same.

5 0
2 years ago
Read 2 more answers
What is the difference between a 13 column abacus and 5 column abacus?
Pepsi [2]

Answer:  The difference between these two types of abaci are the number the beads.

Explanation:

have a great day or night

4 0
2 years ago
"NOTE: write an algorithm, not a code" You are given a file called "std" and composed of "Number, Name, Address" fields. (You ca
Inessa05 [86]

Answer:

1. get the absolute path to the file

2. load the file as a table (dataframe in python)

3. to insert a row;

  • create a dataframe of the same field type
  • concatenate the new dataframe horizontally with the same dataframe

4. to delete a row, select and drop the row where the 'Number' field matches a value.

5. to update the values in row, use the number field as a key to replace the existing values.

6. print of save to a variable the rows where the number field matches a given value.

Explanation:

Follow the report template to create a report for the algorithm.

The algorithm gets the absolute path to the file and loads the file as a tabular file from there the data can be queried without accessing the main file. The insert algorithm creates a new dataframe and appends it to the main dataframe.

The delete, update and retrieve all use the same subalgorithm, getting the rows with the number field as the key value.

5 0
2 years ago
Nina aspires to be a digital media specialist. What should Nina be familiar with in order to pursue this career?
never [62]
D because they do more about software
6 0
3 years ago
Read 2 more answers
Which of the following is the longest division of the geologic time scale
Luden [163]
The longest division of the geologic time scale is eon.
5 0
2 years ago
Read 2 more answers
Other questions:
  • Question 5
    5·1 answer
  • Themes are applied from which tab?
    6·1 answer
  • The_provides access to the internet may also be internal​
    9·1 answer
  • Question 3 of 10
    13·1 answer
  • _____ consists of the instructions that direct the operation of the computer system and enable users to perform specific tasks,
    15·1 answer
  • What is the purpose of citations?
    13·1 answer
  • When the continue statement is encountered in a loop, all the statements in the body of the loop that appear after it are ignore
    5·1 answer
  • _______ allows you to add formatting such as shapes and colors to text.
    14·1 answer
  • What are the first letters of each of the 3 main colors in javaScript? (seperate with commas)
    9·1 answer
  • : Describe the type of gameplay seen during early video games (ex. Spacewar!, Pong).
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!