Question: How do I print the 2d array in a table format and a 1d array besides that table? In the code below I'm printing everything
How do I print the 2d array in a table format and a 1d array besides that table?
In the code below I'm printing everything but it not very readable. The code it just a snippet of my program.
System.out.print("Speed");
for(int i=0; i // printing on top of the table System.out.print( angelsArray[i] + " deg "); } for(int row =0; row for(int col =0; col // need to be printed in the right side of the table System.out.printf("%-2d",speedsArray[col]); // print as a table trajectoryValues = catapult.trajectoriesCalculations(speedsArray, angelsArray); System.out.println(); System.out.printf("%15f", trajectoryValues[row][col]); } } // The current output Speed10 deg 15 deg 20 deg 25 deg 30 deg 35 deg 40 deg 45 deg 10 3.00000015 5.00000020 6.00000025 7.00000030 8.00000035 9.00000040 10.00000045 10.00000010 7.00000015 11.00000020 14.00000025 17.00000030 19.00000035 21.00000040 22.00000045 22.00000010 13.00000015 20.00000020 26.00000025 31.00000030 35.00000035 38.00000040 40.00000045 40.00000010 21.00000015 31.00000020 40.00000025 48.00000030 55.00000035 59.00000040 62.00000045 63.00000010 31.00000015 45.00000020 59.00000025 70.00000030 79.00000035 86.00000040 90.00000045 91.00000010 42.00000015 62.00000020 80.00000025 95.00000030 108.00000035 117.00000040 123.00000045 124.00000010 55.00000015 81.00000020 104.00000025 125.00000030 141.00000035 153.00000040 160.00000045 163.00000010 70.00000015 103.00000020 132.00000025 158.00000030 178.00000035 194.00000040 203.00000045 206.000000 // desired output 
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
