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
How to cite a website, like asha.org?
inn [45]
Using the APA style or the<span> American Psychological Association style of referencing or citing sources, the structure for website reference is as follows:
</span>Last, F. M. (Year, Month Date Published). Article title<span>. Retrieved from URL. Hence, for the problem:
</span>Last, F. M. (Year, Month Date Published). Article title<span>. Retrieved from http://www.asha.org</span>
8 0
3 years ago
What is the best overall approach to education and career development for IT professionals?
LuckyWell [14K]

Professional development is learning to earn or maintain professional credentials such as academic degrees to formal coursework, conferences and informal learning opportunities situated in practice. It has been described as intensive and collaborative, ideally incorporating an evaluative stage.[1] There are a variety of approaches to professional development, including consultation, coaching, communities of practice, lesson study, mentoring, reflective supervision and technical assistance.[2]


5 0
3 years ago
Why does my laptop keep disconnecting from the wifi.
poizon [28]

Answer: you may be connected to wifi near you

Explanation:

1. Restart your computer

2 Then got to settings

3 Go to Wi-Fi

4. Disconnect from your Wi-Fi

5 Connect to your Wi-Fi

If that does not work, go look it up lol.

3 0
2 years ago
Is it safe to turn on a computer without ram?
swat32
Well, it is safe to turn a computer on without a RAM, but you can't really do it. RAM is one of the essential components in computers without which you can't really use a computer. You can turn it on, however, nothing will appear on your screen and the system won't boot. So, technically, it is safe, but it won't do anything to your computer as it cannot run without RAM.
4 0
3 years ago
Read 2 more answers
a_____________ may have its value change during program execution. options. flowchart,counter, Algorithm,None of them​
Amiraneli [1.4K]

Answer:

i think is "none of them"

5 0
3 years ago
Other questions:
  • Choosing firm goals for your business
    7·2 answers
  • While in slide show mode, if you are not careful you can close the application by clicking the x on the menu bar. question 38 op
    12·2 answers
  • Sonora wants to extend the cells to be added in her formula. what is the quickest way to add more sells?
    10·2 answers
  • There is an enormous amount of information on the Internet that is automatically separated into good content and not-so-good con
    15·1 answer
  • List the step in turning on a computer
    6·1 answer
  • Assume that sentence is a variable that has been associated with a string consisting of words separated by single space characte
    12·2 answers
  • What is ana absolute adress
    11·1 answer
  • Running the Disk Cleanup utility is a quick way to ________. Group of answer choices defrag your hard drive remove spyware progr
    10·1 answer
  • Which company provides a crowdsourcing platform for corporate research and development?
    9·1 answer
  • Part 1 of 4 parts for this set of problems: Given an 4777 byte IP datagram (including IP header and IP data, no options) which i
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!