Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(b) Design and implement a Java program that will ask the user for the required number of rows and columns, and then generate a neatly

(b) Design and implement a Java program that will ask the user for the required number of rows and columns, and then generate a neatly laid out table, with each cell indicating the "row,col" values, as in the following example (a table having 3 rows and 4 columns):

 1,1 1,2 1,3 1,4 2,1 2,2 2,3 2,4 3,1 3,2 3,3 3,4 

Note that the cell contents are aligned to the right of a 6 character wide cell. Rather than rely on tabs for such spacing, write a loop that will add space characters to the output data so as to align it within a given column width.

Copy-paste the relevant segment of your code four times, such that your program produces four tables (precede each by an appropriate title), and then modify the copies so they each display one of the following:

the row & column numbers as shown in the example

the product of the row & column number (a multiplication table!)

the cell number beginning from 0 and increasing left to right, top to bottom (i.e. 0,1,2,3 on the first row, 4,5,6,7 on the next, and so on).

the row number in the first column only, putting the String "-" into the other cells. (i.e. 1,-,-,- on the first row, 2,-,-,- on the second, and so on).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

More Books

Students also viewed these Databases questions

Question

What is the purpose of a code of conduct?

Answered: 1 week ago