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
Give an example where traditional laws and modern media have created "grey areas".
olchik [2.2K]
Mainly through firewalls, in order to protect a certain website from hackers or criminals getting into a website, modern media has made grey areas in order to sustain a continuous watch to see if any criminals broke through a firewall
4 0
2 years ago
__________ are the first line of defense against unsafe drivers.
vova2212 [387]
Peace officers are the first line of defense against unsafe drivers. These officers are appointed for a specific purpose of upholding law and order, so they would be the ones who are there to help you in case of an accident caused by unsafe drivers. A peace officers is just another term for a law enforcement officer, or just the police.
5 0
2 years ago
Which statement describes borders and shading ?
Marina CMI [18]

Answer: Borders are rules you can add to any or all of the four sides of a paragraph. Shading is the color or artistic design you use as background for a paragraph. Borders and shading are formatting tools for enhancing text, paragraphs, table cells or frames.

3 0
2 years ago
6. The NADH and FADH2 produced during the Krebs cycle pass their electrons down the 7. __ __ __ __ __ __ __ __ __ __ __ __ __ __
AlladinOne [14]

Answer:

The NADH and FADH2 produced during the Krebs cycle pass the electrons down  electron transport chain in the mitochondria to generate more ATP molecules

Explanation:

FADH2 stands for Flavin adenine dinucleotide and NADH stands for Nicotinamide adenine dinucleotide.

Both are created from FAD and NAD+ through reduction-oxidation reactions in the Krebs cycle during respiration as explained below:

This cycle gives off small amounts of energy in the form of adenosine triphosphate, or ATP, and produces these compounds, FADH2 and NADH. The Krebs cycle is like a wheel. Every time it makes one full rotation, energy is created and released. As you can see from the diagram, the NAD+ and FAD are brought in at key points throughout the cycle and are attached to other electrons resulting in the formation of NADH and FADH2.

This energy is then shuttled off to be used by the cell, mostly for the continuation of cellular respiration.

As they are shuttled away, these two compounds are used to move electrons into the electron transport chain, the final stage of respiration. It is in this stage that most of the energy is created and released from the mitochondria (powerhouse of the cell).

Basically the NADH and FADH2 are affixed with electrons and tranfered to the inner membrane of the mitochondria. The travel down the electron transfer chain, releasing electrons they once had. Thereby releasing alot of energy in the process

3 0
3 years ago
Explain the characteristics of 1st generation computers​
levacccp [35]

Explanation:

i hope this is the right answer

!st generation computers were more big and bulky and you for sure could not bring them around everywhere.

8 0
3 years ago
Other questions:
  • Help! live preview in brackets is not working
    8·1 answer
  • What is one disadvantage of accessing the Internet through a public search engine such as Google or Yahoo?
    10·2 answers
  • BOTH INTERNATIONAL &amp; INLAND Which procedure(s) shall be used to determine risk of collision?
    14·1 answer
  • How do you know if your phone has a virus?
    13·1 answer
  • Before using large downloaded files that are in a compressed format, it is necessary to_____ them. A) Copy B) Extract C) Open D)
    9·1 answer
  • Designers and graphic artists can print finished publications on a color printer, take them to a professional printer, or post t
    15·1 answer
  • A computer is assigned an IP address of 169.254.33.16. What can be said about the computer, based on the assigned address?
    9·1 answer
  • Where in PowerPoint should a user navigate to complete the tasks listed below?
    6·1 answer
  • NEED HELP ASAP!!!!!!
    7·2 answers
  • Please help fast
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!