Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I am trying this question in JAVA 8 but the thing is when I run this code I am getting extra columns and 2 extra
I am trying this question in JAVA 8 but the thing is when I run this code I am getting extra columns and 2 extra "-" in the output.
You have an array of numbers and you would like to print these numbers in a tabular format to make them look more organized. Each cell of the table contains exactly one number and is surrounded by exactly four edges: As you can see above, each corner of the cell is represented by a " t " sign, vertical edges by "-" signs and horizontal edges by "I " signs. The width of the cell adjusts to accommodate the number of digits of the number written within it. There can be many cells in a row. Adjacent cells share an edge: Note that each cell has the same width. The width of the cell adjusts to match the width of the longest number in the table. The numbers in cells are aligned to the right, with any unused area in each cell filled with spaces. The table can consist of many rows, and adjacent rows share an edge: Given A=[4,35,80,123,12345,44,8,5,24,3,22,35] and K=4, the table would appear as follows: The function shouldn't return any value. You can print a string to the output (without or with the end-of-line character) as follows: System, out.print( "sample string"); System,out,println("whole line"); Assume that: - N is an integer within the range [1,200] is - K is an integer within the range [1,1,000,000,000] - each element of array A is an integer within the range [0.1,000,000,000]. In your solution, focus on correctness. The performance of your solution will not be the focus of the assessment. WRONG ANSWER (got Example test: ([4,35,80,123,12345,44,8,5,24,3],4) WRONG ANSWER (got expected expected
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started