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
pshichka [43]
2 years ago
5

Write a Java program that will be able to generate the sample table below.

Computers and Technology
1 answer:
Gwar [14]2 years ago
7 0

Answer:

class Main {

 public static void fillTable(int [][] t, int or, int oc) {        

   for(int r=0; r<t.length; r++) {

     for(int c=0; c<t[r].length; c++) {

         t[r][c] = Math.max(1+Math.abs(r-or), 1+Math.abs(c-oc));

       }

   }

 }

 public static void dumpTable(int [][] t) {

   for(int r=0; r<t.length; r++) {

     for(int c=0; c<t[r].length; c++) {

       System.out.printf("%3d", t[r][c]);

     }

     System.out.println();

   }

 }

 public static void main(String[] args) {

   int origin_row = 3;

   int origin_col = 2;

   

   int[][] table = new int[5][4]; // rows|cols

   fillTable(table, origin_row, origin_col);

   dumpTable(table);

   

 }

}

Explanation:

Above program does not contain input handling and exception handling, but it does contain the cleverness of calculating the cell values. I'm hoping you can add the input handling yourself?

You might be interested in
Michael needs to ensure that those items that are automatically archived are still easily accessible within Outlook. Which optio
juin [17]

Answer:

show archive in folder list

7 0
2 years ago
Read 2 more answers
When an IRET instruction isexecuted, what action takes place?
andrey2020 [161]

Answer:

<u>IRET(Interrupt return) </u>

This instruction is used in x-86 intel cpu architecture.

The IRET instruction provides for a long return to the program or procedure interrupted. IRET and IRETD these two instructions have the same meaning.

Each interrupt procedure has an IRET instruction stating that the routine ends. The execution of the instruction pops up the IP address from the stack and continues to run the primary program.

7 0
3 years ago
___________ is a computer processor which incorporates the functions of a computer's central processing unit (CPU) on a single i
Yanka [14]

Answer:

Microprocessor

Explanation:

A microprocessor is a programmable chip that incorporates in itself the functions of a computer's central processing unit. It contains millions of small components such as transistors and resistors. In fact, the microprocessor is sometimes called the CPU itself as it contains an Arithmetic Logic Unit(ALU), a control unit and register array.

They work at a very high speed due to the components that they contain and are available at relatively low cost. They are portable, reliable and compared to vacuum tubes, they generate less heat.

<em>Hope this helps!</em>

6 0
3 years ago
Read 2 more answers
Which program will have the output shown below?
Ipatiy [6.2K]

Answer: >>> for count in range(10, 14):

   print(count)

Explanation:

just took the test on edg

4 0
3 years ago
Read 2 more answers
You need to design a backup strategy. You need to ensure that all servers are backed up every Friday night and a complete copy o
cestrela7 [59]

Answer: (A) full backup

Explanation: A backup strategy is a term used to describe the various effective approach engaged in creating a backup for data or information.

A FULL BACK UP IS THE VARIOUS APPROACH AND SYSTEMS PUT IN PLACE BY A COMPUTER USER OR AN INFORMATION TECHNOLOGY EXPERT IN ORDER TO CREATE AN ADDITIONAL SAMPLE OR COPY OF AN INFORMATION OR A DATA IN S SINGLE BACKUP.

8 0
3 years ago
Other questions:
  • Which strategy are you using when you only read the title, section headings, and captions?
    12·2 answers
  • Which rule should be followed to stay safe online
    5·1 answer
  • Write a program that asks for the weight of a package and the distance it is to be shipped. This information should be passed to
    12·1 answer
  • Assume that a function with this header: function amountSaved(price, discountRate, salesTaxRate) already exists. Write a single
    14·1 answer
  • Which of these would NOT be a valid Internet Control Message Protocol (ICMP) error message:
    6·1 answer
  • Examples of system software include operating systems like macos, Linux, Android and
    10·2 answers
  • 5. Write the name of the tab, command group, and icon you need to use to access the
    11·2 answers
  • Wha are the types of slide show? define​
    10·1 answer
  • Saitama And Tatsumaki Both Go Shopping Together ,Both have Have 50 loafs of bread , And Saitama takes 43 , How much do Tatsumaki
    14·1 answer
  • Which of the following declares an abstract method in an abstract Java class?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!