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
Hatshy [7]
2 years ago
6

Write the definition of the function inputArray that prompts the user to input 20 numbers and stores the numbers into alpha. Wri

te the definition of the function double Array that initializes the elements of beta to two times the corresponding elements in alpha. Make sure that you prevent the function from modifying the elements of alpha. Write the definition of the function copy AlphaBeta that stores alpha into the first five rows of matrix and beta into the last five rows of matrix. Make sure that you prevent the function from modifying the elements of alpha and beta. Write the definition of the function printArray that prints any one-dimensional array of type int. Print 15 elements per line.
Computers and Technology
1 answer:
Alina [70]2 years ago
4 0

Answer:

In Java:

public static  int[] inputArray(){

   Scanner input = new Scanner(System.in);

   int[] alpha = new int[20];

   for(int i = 0;i<20;i++){

       alpha[i] = input.nextInt();

   }

   return alpha;}

public static  int[] doubleArray(int [] alpha){

   int[] beta = new int[20];

   for(int i = 0;i<20;i++){

       beta[i] = 2 * alpha[i];

   }

   return beta;

}

public static int[] copyAlphaBeta(int [] alpha, int [] beta){

   int [] AlphaBeta = new  int[10];

   for(int i = 0;i<5;i++){

       AlphaBeta[i] = alpha[i];

   }

   int count = 5;

   for(int i = 15;i<20;i++){

       AlphaBeta[count] = beta[i];

       count++;

   }

   return AlphaBeta;

}

public static void printArray(int [] alpha){

   for(int i = 0;i<20;i++){

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

       if((i+1)%15 == 0){

           System.out.println(" ");

       }

   }

}

Explanation:

The inputArray is defined here

public static  int[] inputArray(){

   Scanner input = new Scanner(System.in);

This declares alpha array of 20 elements

   int[] alpha = new int[20];

The following iteration gets input from the user into the array

<em>    for(int i = 0;i<20;i++){</em>

<em>        alpha[i] = input.nextInt();</em>

<em>    }</em>

This returns the alpha array

   return alpha;}

The doubleArray is defined here. It takes the alpha array as its input parameter

public static  int[] doubleArray(int [] alpha){

This declares beta of 20 integers

   int[] beta = new int[20];

This populates beta by 2 * alpha[i]

<em>    for(int i = 0;i<20;i++){</em>

<em>        beta[i] = 2 * alpha[i];</em>

<em>    }</em>

This returns the alpha array

   return beta;}

The copyAlphaBeta array is defines here

public static int[] copyAlphaBeta(int [] alpha, int [] beta){

This declares AlphaBeta as 10 elements

   int [] AlphaBeta = new  int[10];

This populates the first 5 elements of AlphaBeta with the first 5 of alpha

<em>    for(int i = 0;i<5;i++){</em>

<em>        AlphaBeta[i] = alpha[i];</em>

<em>    }</em>

   int count = 5;

This populates the last 5 elements of AlphaBeta with the last 5 of beta

<em>    for(int i = 15;i<20;i++){</em>

<em>        AlphaBeta[count] = beta[i];</em>

<em>        count++;</em>

<em>    }</em>

This returns the AlphaBeta array

   return AlphaBeta;

}

The printArray is defined here. It takes the alpha array as its input parameter

public static void printArray(int [] alpha){

This iterates through alpha array

   for(int i = 0;i<20;i++){

This prints each element of the array

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

A new line is started after the 15th element

<em>        if((i+1)%15 == 0){</em>

<em>            System.out.println(" ");</em>

<em>        }</em>

   }

}

See attachment for complete program which includes the main

Download txt
You might be interested in
Peter is software designer working at a big software company. He just found out that he has been shifted to their downtown branc
sweet [91]

The managers at Peter’s company have an Autocratic environment.

<u>Explanation:</u>

The managers who are autocratic in nature make decisions on their own. They will never get insights of their employees and they will not take the inputs of them in taking any decisions. This type of management is suitable in an organisation where there is an urgent need to taking decisions to any matter.

Managers who are autocratic in nature will make decisions without consulting anyone's advice.  This type suits those organisations wherein there are very less number of employees. Here, the manager of Peter did not consulted peter in making decisions related to him, the environment is authoritarian or autocratic.  

7 0
2 years ago
How to see if your computer has bluetooth?
RUDIKE [14]
Assuming you're running Windows, click the start button, and then search for "Device Manager" (or open CMD or PowerShell and type devmgmt.msc). Look at the list of devices. If Bluetooth is there, you have it; if it's not there, you don't. 
3 0
2 years ago
Gary says, "Ports are where data enter a network before reaching a gateway. The data travel via transmission
m_a_m_a [10]

The correct explanation of why Gary is wrong is that Ports are where connectors attach to destinations, not where data enter the network.

<h3>What is a port?</h3>

A port is physical part of the computer system where the external devices are connected using cables.

Therefore, it serves as an interface between the motherboard and an external device of the computer.

From Gary statement about ports, he is wrong because, Ports are where connectors attach to destinations, not where data enter the network.

Learn more about ports here:

brainly.com/question/4804932

#SPJ1

3 0
2 years ago
Research current rates of monetary exchange. Draw a flowchart or write pseudocode to represent the logic of a program that allow
Anastasy [175]

Explanation:

Start

Input dollars

Set Euros = 0.91 * dollars

Set Yens = 109.82 * dollars

Output Euros

Output Yens

Stop

Note: The rates are as of 07-Feb-2020

7 0
3 years ago
2 examples of free, proprietary and online software for multimedia presentations (two of each) ._.
photoshop1234 [79]

Answer:

1. PowerPoint online

2. Goógle Slides

Explanation:

There is a various free, proprietary, and online software for multimedia presentations available for use. Some of which include:

1. PowerPoint online: this is an online and free version of Microsoft Office PowerPoint software. Some of its features include text formatting, use of animations, cloud storage among others.

2. Goógle Slides: This is a product of Goógle to make the multimedia presentation of documents available online. It also offers many feature including cloud storage.

4 0
2 years ago
Other questions:
  • Standards for all managers ethical responsibilities are covered in a company's
    7·2 answers
  • Claudia has a bachelors degree in computer information systems and she has learned to use some popular software testing tolls wh
    13·2 answers
  • The term “computer literacy” dates back to what decade? <br> 1960s<br> 1970s<br> 1980s<br> 1990s
    5·1 answer
  • A coworker asks your opinion about how to minimize ActiveX attacks while she browses the Internet using Internet Explorer. The c
    14·1 answer
  • State why hexadecimal is used to display the error code
    11·1 answer
  • How many bits can a memory chip with the below configuration support? For full credit, show how you got the answer.
    15·1 answer
  • Consider the conditions and intentions behind the creation of the internet—that it was initially created as a tool for academics
    12·1 answer
  • Match the context details with the pattern that applies.
    7·1 answer
  • Match the TCP/IP Layer to a problem that can happen there.
    8·1 answer
  • Why might you use the More button in the Find and Replace dialog box?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!