/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
public class Main
{
public static void main(String[] args) {
String squadre[][] =
{
{"Paolo", "Daniele", "Matteo", "Alessandro", "David"},
{"Alessio", "Emanuele", "Cladio", "Massimo", "Mohammad"},
{"Gianluca", "Farid", "Matteo", "Stefano", "Massimiliano"},
{"Manuel", "Andrea", "Valerio", "Danilo", "Stefano"}
};
int goal[][] =
{
{0, 3, 4, 20, 34},
{0, 5, 3, 21, 31},
{1, 4, 3, 32, 26},
{1, 2, 4, 30, 27}
};
System.out.println("\nMatrice delle squadre");
for(int i = 0; i < squadre.length; i++) {
for (int j = 0; j < squadre[i].length; j++) {
System.out.printf("%-12s", squadre[i][j]);
}
System.out.print("\n");
}
// int goal[][] = new int [4][5];
// Scanner tastiera = new Scanner(System.in);
// for (int i = 0; i < goal.length; i++) {
// for (int j= 0; j < goal[i].length; j++) {
// System.out.print("Goal fatti da " + squadre[i][j] + ": ");
// goal[i][j] = tastiera.nextInt();
// }
// }
System.out.println("\nMatrice dei goal");
for (int i = 0; i < goal.length; i++) {
for (int j= 0; j < goal[i].length; j++) {
System.out.printf("%8d", goal[i][j]);
}
System.out.println();
}
System.out.println("\nGoal segnati dalle varie squadre");
int somma;
for (int i = 0; i < goal.length; i++) {
somma = 0;
for (int j= 0; j < goal[i].length; j++) {
somma = somma + goal[i][j];
}
System.out.println("La squadra " + i + " ha fatto " + somma + " goal");
}
System.out.println("\nGoal segnati dai diversi ruoli");
for (int j = 0; j < goal[0].length; j++) {
somma = 0;
for (int i= 0; i < goal.length; i++) {
somma = somma + goal[i][j];
}
System.out.println("Giocatore " + j + " ha fatto " + somma + " goal");
}
}
}