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<mat[r].length; c++) { out.print("Enter a value for spot " + r + " - " + c + " :: "); mat[r][c]=keyboard.nextInt(); } } out.println("\nThreeDRay before setting mat at spot "+i); //print out the ThreeDRay - call toString() //call setMatrix out.println("\nThreeDRay after setting mat at spot "+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 + " "); } out.println(); } } }...
View Full Document

This note was uploaded on 01/24/2011 for the course COMP SCI 543 taught by Professor Mark during the Spring '10 term at Brown College.

Page1 / 2

Lab24i - for(int c=0 c<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