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) {
double[][] ventas = {
//Matriz de ventas
{120, 140, 130, 160},
{100, 110, 125, 150},
{180, 170, 190, 200},
{200, 210, 225, 250},
{80, 70, 90, 50}
};
double total=0;
double prome=0;
for (int i = 0; i < ventas.length; i++) {
for (int j = 0; j < ventas[i].length; j++){
System.out.print(ventas[i][j] + "\t");
}
System.out.println();
}
System.out.println("------------------------------------");
for (int i = 0; i < ventas.length; i++) {
total =0;
for (int j = 0; j < ventas[i].length; j++){
total += ventas[i][j];
}
System.out.println();
prome = total/(ventas[i].length);
System.out.println("El total de las ventas de la tienda " + (i+1) + " fue: " +total);
System.out.println("El promedio de las ventas totales de la tienda " + (i+1) + " fue: " +prome);
System.out.println("-*-");
}
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: