1

Можете помочь написать метод Multiple который создает две матрицы и умножает их.

 public static Matrix fillByKeyboard() {
        Scanner scan = new Scanner(System.in);
        System.out.println("Enter The Number Of Matrix Rows:");
        int rowCount = scan.nextInt();
        System.out.println("Enter The Number Of Matrix Columns:");
        int colCount = scan.nextInt();
        try {
            Matrix m = new Matrix(rowCount, colCount);
            System.out.println("Enter Matrix Data:");
            for (int i = 1; i <= rowCount; i++) {
                for (int j = 1; j <= colCount; j++) {
                    int value = scan.nextInt();
                     m.put(i, j, value);
                }
            }
            return m;

        } catch (MatrixIndexException ex) {
            System.err.println(ex.getMessage());

        }
        return null;

    }

    public static void MatrixMultiple(){
        Scanner scan = new Scanner(System.in);
        System.out.println("Enter The Number of Rows");
        int rowCount = scan.nextInt();
        System.out.println("Enter The Number of Columns");
        int colCount = scan.nextInt();

    }
}

0

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Посмотрите другие вопросы с метками или задайте свой вопрос.