Create a class OperateArray in which you create a 2 x 3 integer array with all zeros in it. Allow the user to traverse the array to enter the 6 values in the array. The user will fill in the top row first, then the bottom row. The class should then subtract the bottom number from the top number in each column, and then add the results of the 3 subtractions to get a total. Enter the data shown below
| 6 5 4| Top row of array
|3 2 3| Bottom row of array
The correct answer is 7.

Answers

Answer 1

Answer:

The programming language is not stated; however, I'll answer this question using Java programming language.

Because of the length of the program, comments are used to explain some lines

See Attachment for program file

Program starts here

import java.util.*;

public class OperateArray{

public static void main(String [] args)

{

 Scanner input = new Scanner(System.in);

 //Declare Array

 int arr[][] = new int[2][3];

 //Fill array with 0

 for(int row =0;row<2;row++)

 {

  for(int col=0;col<3;col++)

  {

   arr[row][col] = 0;

  }

 }

 //Prompt user for input

 for(int row =0;row<2;row++)

 {

  if(row == 0)

  {

   System.out.print("Enter top rows\n"); //Top rows

  }

  else

  {

   System.out.print("Enter bottom rows\n"); //Bottom Rows

  }

  for(int col=0;col<3;col++)

  {

   arr[row][col] = input.nextInt();

  }

 }

 //Initialize difference to 0

 int diff = 0;

 //Print and Calculate Difference

 for(int row =0;row<2;row++)

 {

  for(int col=0;col<3;col++)

  {

   if(row<1)

   {

   if(col<2)

   {

    System.out.print(arr[row][col]+" ");

   }

   else

   {

    System.out.print(arr[row][col]+" |Top Row of Array\n");

   }

   //Add top rows

   diff+=arr[row][col];

   }

   else

   {

    if(col<2)

   {

    System.out.print(arr[row][col]+" ");

   }

   else

   {

    System.out.print(arr[row][col]+" |Bottom Row of Array\n");

   }

   //Subtract bottom rows from top

   diff-=arr[row][col];

   }

  }

 }

 //Print Difference

 System.out.print("Difference: "+diff);

}

}

//End of Program

Answer 2
It is the top row so it is 7

Related Questions

Which of the following will help sober up and lower the BAL of an intoxicated person? Exercise Black coffee Time A cold shower

Answers

Where are the following to these questions ?

Answer:

Time

Explanation: time gives the liver the chance to do its job and metabolize the alcohol. Although...exercise can help wake up the body and make a person more alert. It may also help metabolize alcohol more quickly, although the scientific evidence of this is inconclusive.

The practice of honoring those who have been lost in battle dates back to which two ancient
civilizations?

Answers

It was between Iranians and filapinons nice work man it’s easy
Indus River valley civilizations I don’t really know anymore on the top of my headache
Other Questions
HELP ASAP!! What is the output value for the following function, f(x) = 5x - 2 if the input value is 3? A. 17B.51C. 13D. 1 Please helpp! A box that has a mass of 80 kg slides down a ramp with a 30 degree angle. The free-body diagram shows the forces acting on the box. A block is shown on a 30-degree incline with a free body diagram drawn on the block with 2 force vectors. The first vector is pointing away from the surface of the incline and perpendicular to the surface, labeled F Subscript N Baseline. The second vector is pointing straight down to the center of the earth, labeled F Subscript g Baseline. Ignoring friction and air resistance, what is the acceleration of the box, to the nearest tenth? 0.5 m/s2 4.9 m/s2 8.5 m/s2 9.8 m/s2HOW TO DO IT HELPPPPPPP PLEASEEE!!! Question is in the picture: What is BMR and how it affects your calorie needs Id you drop me I'm sure to crack, but give me a smile and I'll always smile back. what an me I? Question 11 (1 point)Which of the following is not the name of a taxon?OrderO FamilyO ClassO Association where does the independent variable go on a graph 9.0 L of a gas at 25 oC expands to a volume of 25.0 L. What is the resulting temperature in Kelvin? Determine the amount of heat (in kJ) associated with the production of 5.71 104 g of ammonia according to the following equation. N2(g) + 3H2(g) 2NH3Hrxn = 92.6 kJ Assume that the reaction takes place under standard-state conditions at 25C. what is the answer for n ? Select the transitional word from the sentence below.aAs a result, Chekhov left the theater after the performance and vowed never to write another play.As a resultafterb. andd. as a result, andC.afterA.as a result Shakespeare uses the structure to these lines to How do you say "what is the temperature like" in french the area that lies between Z= - 0.42 and Z= 0.42 is how does this poster play on a parents emotions?check all that apply Isabel is creating a wireframe she has drawn a layout for the home page along with outlining the navigation elements she now wants to represent content and a banner for the home page what should she use? Isabel should use (???) to show where the content and banner will go Inscribed Angles - Find the value of x - WILL GIVE BRAINLIEST! Solve the inequality. Simplify (5 + 1)^2- (11 +32) divided by 4