Lab24i - { for(int c=0; c<mat[r].length; c++) {

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
// A+ Computer Science  -  www.apluscompsci.com  //Name -  //Date -  //Lab  -  import java.util.Scanner;  import java.util.Arrays;  import static java.lang.System.*;  public class Lab24i  public static void main( String args[] )     Scanner keyboard = new Scanner(in);  out.print("How many matrices do you wish to enter? :: ");  int matCnt = keyboard.nextInt();  //instantiate a ThreeDRay  for(int i = 0; i < matCnt; i++)  out.print("What is the size of matrix " + i + " : ");  int size = keyboard.nextInt();  int[][] mat = new int[size][size];  out.println();  for(int r=0; r<mat.length; r++) 
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { for(int c=0; c&lt;mat[r].length; c++) { out.print(&quot;Enter a value for spot &quot; + r + &quot; - &quot; + c + &quot; :: &quot;); mat[r][c]=keyboard.nextInt(); } } out.println(&quot;\nThreeDRay before setting mat at spot &quot;+i); //print out the ThreeDRay - call toString() //call setMatrix out.println(&quot;\nThreeDRay after setting mat at spot &quot;+i); //print out the ThreeDRay - call toString() //call setMatrix } int ans=new int[0][0]; // = test.addMatrices(0,1); for(int row : ans) { for(int c : row) { out.print(c + &quot; &quot;); } out.println(); } } }...
View Full Document

Page1 / 2

Lab24i - { for(int c=0; c&amp;amp;lt;mat[r].length; c++) {

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online