Java - necesito ayuda urgente con este codigo

 
Vista:
sin imagen de perfil

necesito ayuda urgente con este codigo

Publicado por Juan Sebastian (1 intervención) el 18/04/2023 16:14:10
me falta el PUNTO 2 no me quiere aparecer :(

1. Generar 100 sorteos del Baloto y 100 sorteos de Baloto revancha respectivamente, cada uno de éstos con los 5 números del 1 al 43 y la super balota del 1 al 16.
2. Generar los números de un tiquete de Baloto, con el cual se participará en el sorteo, compuesto por 5 números del 1 al 43 y la super balota del 1 al 16, y con dicho tiquete generado, identificar cuales son los 3 sorteos de Baloto y 3 Baloto Revancha en los cuales ganó o estuvo mas cerca de ganar (mayor cantidad de aciertos. Máxima cantidad de aciertos: 6 números).

package Logica;

public class BalotoAleatoria {

// Sus atributos
private final int[] Baloto = new int[6];
private final int[] BalotoGanadora = new int[6];
public int[] RepetidorBaloto = new int[43];
public int MatrizBaloto[][] = new int[1][6];

// Constructor
public BalotoAleatoria() {

for (int i = 0; i < 5; i++) {
this.Baloto[i] = 0;
}

for (int i = 0; i < 43; i++) {
this.RepetidorBaloto[i] = 0;
}

for (int i = 0; i < MatrizBaloto.length; i++) {
for (int j = 0; j < MatrizBaloto[i].length; j++) {
MatrizBaloto[i][j] = 0;
}
}

}

public BalotoAleatoria(int num1, int num2, int num3, int num4, int num5, int num6) {

this.Baloto[0] = num1;
this.Baloto[1] = num2;
this.Baloto[2] = num3;
this.Baloto[3] = num4;
this.Baloto[4] = num5;
this.Baloto[5] = num6;

}

// Metodos get y set
public int getNum1() {
return Baloto[0];
}

public void setNum1(int num1) {
this.Baloto[0] = num1;
}

public int getNum2() {
return Baloto[1];
}

public void setNum2(int num2) {
this.Baloto[1] = num2;
}

public int getNum3() {
return Baloto[2];
}

public void setNum3(int num3) {
this.Baloto[2] = num3;
}

public int getNum4() {
return Baloto[3];
}

public void setNum4(int num4) {
this.Baloto[3] = num4;
}

public int getNum5() {
return Baloto[4];
}

public void setNum5(int num5) {
this.Baloto[4] = num5;
}

public int getNum6() {
return Baloto[5];
}

public void setNum6(int num6) {
this.Baloto[5] = num6;
}

// Metodo para generar los datos aleatorios.
public void generar() {

for (int i = 0; i < 5; i++) {
this.Baloto[i] = (int) (Math.random() * 43) + 1;
this.BalotoGanadora[i] = (int) (Math.random() * 43) + 1;
if (RepetidorBaloto[Baloto[i] - 1] == 1) {
i = i - 1;
} else {
RepetidorBaloto[Baloto[i] - 1] = 1;
}
}

this.Baloto[5] = (int) (Math.random() * 16) + 1;
this.BalotoGanadora[5] = (int) (Math.random() * 16) + 1;
}

public void generarGanador() {

for (int i = 0; i < 5; i++) {
this.BalotoGanadora[i] = (int) (Math.random() * 43) + 1;
this.BalotoGanadora[i] = (int) (Math.random() * 43) + 1;
if (RepetidorBaloto[BalotoGanadora[i] - 1] == 1) {
i = i - 1;
} else {
RepetidorBaloto[BalotoGanadora[i] - 1] = 1;
}
}

this.Baloto[5] = (int) (Math.random() * 16) + 1;
}

//Matrix
public void guardar() {

for (int i = 0; i < MatrizBaloto.length; i++) {
for (int j = 0; j < MatrizBaloto[i].length; j++) {
this.MatrizBaloto[i][j] = Baloto[j];
}
}
}

public void imprimir() {

for (int i = 0; i < MatrizBaloto.length; i++) {

for (int j = 0; j < MatrizBaloto[i].length; j++) {

System.out.print( MatrizBaloto[i][j] + " ");

}

System.out.println("");
}

}

//Busqueda Secuencial
int num_buscado = this.BalotoGanadora[0];

public void Buscar_Secuencial() {

for (int e = 0; e < Baloto.length; e++) {
if (Baloto[e] == num_buscado) {
System.out.println("El numero solicitado esta en la posicion " + e);
}
}

}

}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder