import java.util.*;
import java.lang.*;
import java.io.*;

// The main method must be in a class named "Main".
class Main {
    public static void main(String[] args) {
        System.out.println("Practica guiada: ampliar el registro");
        
        // Paso 5.
        int[][] libros = {
            {4, 6, 5, 7},
            {3, 2, 4, 5},
            {6, 8, 7, 9}
        };
        
        // Paso 7 y 8.
        for (int i = 0; i < libros.length; i++) {
            int totalGenero = 0;
            System.out.print("Genero " + (i + 1) + "(");
            
            for (int j = 0; j < libros[i].length; j++) {
                totalGenero += libros[i][j];
                
                System.out.print(libros[i][j]);
                if (j < libros[i].length - 1) {
                    System.out.print(", ");
                }
            }
            
            System.out.println(" ) Total del genero: " + totalGenero);
        }
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: