java - Why is this method being skipped when it is called correctly with no syntax errors? -


Here is the original code for what is happening. I have already been encouraged to input the number of rows and columns, which works This problem once the program reaches "enter data ..." it prints, But completely ignores the call on the matrix . Inside matrix I also prompt to enter a matrix using the scanner class. Apart from this, I know that there is no end to its end. help please.

  Case 1: System.out.println ("Enter data for first matrix."); // Input needed MatrixOne = matrix (rows, columns); Println ("+"); System.out.println ("Enter data for second matrix."); Matrixout = matrix (rows, columns); Int [] [] plus = add (matrixon, matrix two, rows, columns); Print (lines, columns, plus); break;  

Here is the method:

  public static int [] [] matrix (int rows, favored column) {int [] [] NewMatrix = new integer [Rows] [column]; For (int i = 0; i  

This is currently output:

  Please choose a procedure: additional (1) or subtract (2) 1 of the rows you like is the matrix ? 2 How many columns your matrix should want? 2 Enter the data for the first matrix. + Enter data for other metrics = Please choose an operation: add (1) or subtract (2)  

It is above everything:

  Int rows = 0; Integer column = 0; Int [] [] MatrixOn; Int [] [] Matrix two; Do {System.out.print ("Please choose an operation: additional (1) or subtract (2)"); Operation = keyboard.nextInt (); Row column (rows, columns);  

and this is the method:

  public static zero row columns (int rows, et columns) {scanner keyboard = new scanner (System.in); System.out.println ("How many lines would you like your metrics?"); Line = keyboard NixInt (); System.out.println ("How many columns would you prefer your metrics?"); Column = keyboard.nextInt (); }  

and main :

  public static zero main (string [] args) {String End; Int operation; Int rows = 0; Integer column = 0; Int [] [] MatrixOn; Int [] [] Matrix two; Do {System.out.print ("Please choose an operation: additional (1) or subtract (2)"); Operation = keyboard.nextInt (); Row column (rows, columns); ///////////////// INPUT and prepares for adding or submitting entries ///////////////////// ///////////// The switch (operation) // reads the value of variable operation if the operation is equal to 1, then the program will add matrix ... if the operation is equal to 2, then The program will reduce the metric, and if the operation is equivalent to 1 or 2, then ... // the user will be prompted again to enter 1 or 2 {Case 1: System.out.println ("First matte Enter data to Ricks. "); // Input needed MatrixOne = matrix (rows, columns); Println ("+"); System.out.println ("Enter data for second matrix."); Matrixout = matrix (rows, columns); Int [] [] plus = add (matrixon, matrix two, rows, columns); Print (lines, columns, plus); break; Case 2: System.out.println ("Enter data for first matrix."); Matrixon = matrix (rows, columns); Println ("-"); System.out.println ("Enter data for second matrix."); Matrixout = matrix (rows, columns); Int [] [] Debt = Decrease (matrixon, matrix two, rows, columns); Print (rows, columns, zeros); break; Default: System.out.println ("Please enter 1 or 2 to add matrix to subtract."); } // end of switch} while (operation! = 1 = operation! = 2); } // main  

The end of the matrix method, it will not enter the loop if the lines or Column is zero; That's why they might have zero value.


Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -