WHEN I TRY TO SELECT SOME OPTIONS DO NOT SHOW ME ANYTHING [closed]

-2
import java.util.Scanner;
public class Algoritmo {
Scanner leer= new Scanner (System.in);


    public static void main(String[] args) {

  Algoritmo  menu= new Algoritmo();
       menu.menuGeneral();
    }

   public int menuGeneral(){
   int opcion;
   do{
       System.out.println("");
       System.out.println("===================================================");
       System.out.println("================= MENU DE OPCIONES ================");
       System.out.println("1.SUMA DE MATRICES                       ");
       System.out.println("2.MULTIPLICACION DE MATRICES             ");
       System.out.println("3.TRANSPUESTA MATRIZ A y B               ");
       System.out.println("4.SUMA DIAGONAL PRINCIPAL MATRIZ A^B     ");
       System.out.println("5.MAXIMO Y MINIMO MATRIZ A ^ B           ");
       System.out.println("6.COLUMNA IMPAR ^ FILAS PARES MATRIZ A^B ");
       System.out.println("7.SALIR                                  ");
       System.out.println("===================================================");
       System.out.print("Ingrese una opcion: ");
       opcion=leer.nextInt();

       switch(opcion){
           case 1:System.out.println("SumadeMatriz"); break;
           case 2: System.out.println("MultiplicacionMatriz");break;
           case 3: System.out.println("TranspuestaMatriz");break;
           case 4: System.out.println("DiagonalPrincipalMatrices");break;
           case 5: System.out.println("MaximoMinimoMatriz");break;
           case 6: System.out.println("ColumnaImparFilaPar");break;
           case 7: System.out.println("................Saliendo del menu ..............");
               System.exit(0); break;
           default: System.out.println("Ingrese una opcion valida.......!!"); break;

       }



   }while(opcion != 8); 
   return 0;
   }

public void MaximoMinimoMatriz(){

        int n, m, i, j;
        int A[][] = new int[10][10];
        int B[][] = new int[10][10];

        System.out.print("Ingrese dimension n: ");
        n = leer.nextInt();
        System.out.print("Ingrese dimension m: ");
        m = leer.nextInt();

        System.out.println("INGRESE VALORES MATRIZ A");
        for (i = 1; i <= n; i++) {
            for (j = 1; j <= m; j++) {
                System.out.print("A[" + (i) + "," + (j) + "]= ");
                A[i][j] = leer.nextInt();
            }
        }

        System.out.println("INGRESE VALORES MATRIZ B");
        for (i = 1; i <= n; i++) {
            for (j = 1; j <= m; j++) {
                System.out.print("B[" + (i) + "," + (j) + "]= ");
                B[i][j] = leer.nextInt();
            }
        }

        //IMPRIMIENDO MATRICES A Y B
        System.out.println("======== MATRIZ A =========");
        for (i = 1; i <= n; i++) {
            for (j = 1; j <= m; j++) {
                System.out.print("\t" + A[i][j]);
            }
            System.out.println();
        }

        System.out.println("====== MATRIZ B ========");
        for (i = 1; i <= n; i++) {
            for (j = 1; j <= m; j++) {
                System.out.print("\t" + B[i][j]);
            }
            System.out.println();
        }

       int menorA=A[1][1],mayorA=A[1][1],menorB=B[1][1],mayorB=B[1][1];

        System.out.println("*********************  MATRIZ A (MAXIMO Y MINIMO) ***************");
        for (i = 1; i <= n; i++) {
            for (j = 1; j <= m; j++) {
                //calculo del MENOR valor de la matriz
                if(i!=1 && j!=1){
                 if(A[i][j]>mayorA){
                    mayorA=A[i][j];
                }
                //calculo del MAYOR valor de la matriz
                if(A[i][j]<menorA){
                    menorA=A[i][j];
                }
                }
            }
        }

        System.out.println("NUMERO MENOR DE MATRIZ : "+menorA);
        System.out.println("NUMERO MAYOR DE MATRIZ : "+mayorA);

        System.out.println("*********************  MATRIZ B (MAXIMO Y MINIMO) ****************");
        for (i = 1; i <= n; i++) {
            for (j = 1; j <= m; j++) {
                //calculo del mayor valor de la matriz
                if(i!=1 && j!=1){
                 if(B[i][j]>mayorB){
                    mayorB=B[i][j];
                }
                //calculo del menor valor de la matriz
                if(B[i][j]<menorB){
                    menorB=B[i][j];
                }
                }
            }
        }

        System.out.println("NUMERO MENOR DE MATRIZ : "+menorB);
        System.out.println("NUMERO MENOR DE MATRIZ :"+mayorB);

}

}
    
asked by Swan Andres 24.09.2018 в 01:32
source

1 answer

0

Your method "menuGeneral" modify it, put it that you did not return anything

 public void menuGeneral();

And in the part of your "while (option! = 8)" it is assumed that your option to exit is number 7, therefore it would have to be "while (option! = 7)"

    do//haz esto

      //instruciones

     while(opcion != 7) //mientras opcion sea diferente de 7, siendo 7 quiere decir que se ya no es necesario seguir haciendolo
    
answered by 24.09.2018 / 02:17
source