Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package tablaescuelas;
- public class TablaEscuelas {
- //5000 lĂmite
- public static void main(String[] args) {
- //Entrada
- //Generar una matriz con los datos
- String recinto = "";
- char candidato = 'A';
- int suma_total = 0;
- int filas = 15;
- int columnas = 4;
- int matriz[][] = new int [5][15];
- generarTabla(matriz, filas, columnas);
- mostrarTabla(matriz, recinto, candidato, filas, columnas);
- }
- public static void generarTabla(int matriz[][], int filas, int columnas){
- for (int i = 0; i<columnas ; i++){
- for (int j = 0; j<filas; j++){
- matriz[i][j] = (int) (Math.random() * 5000)+1;
- }
- }
- }
- public static void mostrarTabla(int matriz[][], String recinto, char candidato, int filas, int columnas){
- for (int i = 0; i<columnas ; i++){
- for (int j = 0; j<filas; j++){
- switch(i){
- case 0:
- candidato = 'A';
- break;
- case 1:
- candidato = 'B';
- break;
- case 2:
- candidato = 'C';
- break;
- case 3:
- candidato = 'D';
- break;
- }
- switch(j){
- case 0:
- recinto = "ESCUELA STANDARD D-534 MATTA 0151";
- break;
- case 1:
- recinto = "LICEO B-20 ANIBAL PINTO PINTO 0150";
- break;
- case 2:
- recinto = "ESCUELA D-470 ARTURO PRAT GRAL MACKENNA 685";
- break;
- case 3:
- recinto = "ESCUELA D-499 SAN ANTONIO A VARAS ESQ MATTA";
- break;
- case 4:
- recinto = "LICEO A-23 MARCELA PAZ ANTONIO VARAS 630";
- break;
- case 5:
- recinto = "HOGAR ESTUDIANTIL PRAT ESQ BILBAO";
- break;
- case 6:
- recinto = "INSTITUTO CLARET ZENTENO 453";
- break;
- case 7:
- recinto = "LICEO A-28 P. NERUDA BALMACEDA 650";
- break;
- case 8:
- recinto = "LICEO A-21 BALMACEDA 598";
- break;
- case 9:
- recinto = "ESCUELA MILLARAY RAYEN 01010";
- break;
- case 10:
- recinto = "ESCUELA LLAIMA COQUIMBO 745";
- break;
- case 11:
- recinto = "ESCUELA D-508 GABRIELA MISTRAL SN";
- break;
- case 12:
- recinto = "ESCUELA SAN FRANCISCO MONTT 071";
- break;
- case 13:
- recinto = "ESCUELA D-478 CAUPOLICAN 105";
- break;
- case 14:
- recinto = "ESC STA CAROLINA DE PEDRO DE V P DE VALDIVIA";
- break;
- }
- System.out.println("Candidato: "+candidato+" Recinto: "+recinto + " Cant. Votos: "+matriz[i][j]);
- }
- }
- }
- public static void calcularTotal(int matriz[][], int suma_total, int filas, int columnas){
- for (int i = 0; i<columnas ; i++){
- suma_total = 0;
- for (int j = 0; j<filas; j++){
- suma_total += matriz[i][j];
- }
- }
- }
- public static void mostrarMasVotado(int matriz[][], int suma_total, int filas, int columnas){
- for (int i = 0; i<columnas ; i++){
- for (int j = 0; j<filas; j++){
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement