Nico creation methodes vides #7

Merged
NyxiumYuuki merged 33 commits from Nico_Creation_Methodes_vides into main 2021-02-01 18:45:25 +01:00
2 changed files with 206 additions and 26 deletions
Showing only changes of commit f8ff9b93fb - Show all commits

View file

@ -8,28 +8,46 @@ import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
public class Choix { public class Choix {
DataBase maDB; public DataBase maDB;
Connection conn; public Connection conn;
long numselect[]; public long numSelect[];
long numId[][]; public int bonusSelect;
long numCpt[][]; public long numId[][];
long bonusid[][]; public long numCpt[][];
long bonusCpt[][]; public long bonusId[][];
long combi1Id[][]; public long bonusCpt[][];
long combi1Cpt[]; public long combi1Id[][];
public long combi1Cpt[];
public long combi2Id[][];
public long combi2Cpt[];
public long num1_bonusId[][];
public long num1_bonusCpt[];
public long num2_bonusId[][];
public long num2_bonusCpt[];
public long num3_bonusId[][];
public long num3_bonusCpt[];
public Choix(){ public Choix(){
maDB=new DataBase(); maDB=new DataBase();
maDB.getConnection(); maDB.getConnection();
numselect =new long[5]; numSelect =new long[5];
numId =new long[50][4000]; numId =new long[50][4000];
numCpt = new long[50][2]; numCpt = new long[50][2];
combi1Id =new long[50][4000]; combi1Id =new long[50][4000];
combi1Cpt = new long[50]; combi1Cpt = new long[50];
bonusid=new long[11][4000]; num1_bonusId =new long[11][4000];
num1_bonusCpt = new long[11];
num2_bonusId =new long[11][4000];
num2_bonusCpt = new long[11];
num3_bonusId =new long[11][4000];
num3_bonusCpt = new long[11];
combi2Id=new long[50][4000];
combi2Cpt=new long[50];
bonusId =new long[11][4000];
bonusCpt=new long[11][2]; bonusCpt=new long[11][2];
conn= maDB.getConnection(); conn= maDB.getConnection();
} }
public void afficherChiffre1() throws SQLException { public void afficherChiffre1() throws SQLException {
System.out.println("debut afficherChiffre1");
int k=0, numprec=0, l=0; int k=0, numprec=0, l=0;
ResultSet rs=null; ResultSet rs=null;
String sql; String sql;
@ -61,9 +79,7 @@ public class Choix {
} }
j=0; j=0;
} }
for (int i=0; i<50;i++) { //for (int i=0; i<50;i++) { System.out.println(i+" :"+ numCpt[i][1]); }
System.out.println(i+" :"+ numCpt[i][1]);
}
for (int i=1; i<=5;i++) { for (int i=1; i<=5;i++) {
sql = "SELECT Test_Table.annee_numero_de_tirage, Test_Table.boule_" + i + " FROM myny.Test_Table ORDER BY Test_Table.boule_" + i + "; "; sql = "SELECT Test_Table.annee_numero_de_tirage, Test_Table.boule_" + i + " FROM myny.Test_Table ORDER BY Test_Table.boule_" + i + "; ";
@ -89,7 +105,7 @@ public class Choix {
k++; k++;
} }
numId[rs.getInt(2)][k]=rs.getInt(1); numId[rs.getInt(2)][k]=rs.getInt(1);
System.out.println(numId[rs.getInt(2)][k]); //System.out.println(numId[rs.getInt(2)][k]);
numprec=rs.getInt(2); numprec=rs.getInt(2);
} }
k=0; k=0;
@ -106,13 +122,16 @@ public class Choix {
} }
} }
public void afficherCombinaisons2(int chiffre1){ public void afficherCombinaisons2(int chiffre1) throws SQLException {
afficherChiffre1();
System.out.println("debut afficherCombinaisons2");
numSelect[1]=chiffre1;
int j=0, k=0, l=0, cpt=0; int j=0, k=0, l=0, cpt=0;
for(int i=1;i<50;i++) { for(int i=1;i<50;i++) {
if (i != chiffre1) { if (i != chiffre1) {
while (numId[chiffre1][j] != 0) { while (numId[chiffre1][j] != 0) {
while (numId[i][k] != 0) { while (numId[i][k] != 0) {
System.out.println(numId[i][k] +"=="+ numId[chiffre1][j]); //System.out.println(numId[i][k] +"=="+ numId[chiffre1][j]);
if (numId[i][k] == numId[chiffre1][j]) { if (numId[i][k] == numId[chiffre1][j]) {
combi1Cpt[i]++; combi1Cpt[i]++;
combi1Id[i][cpt++]=numId[i][k]; combi1Id[i][cpt++]=numId[i][k];
@ -140,7 +159,48 @@ public class Choix {
} }
} }
public void afficherNumBonus() throws SQLException {
public void afficherCombinaisons3(int chiffre1, int chiffre2) throws SQLException {
afficherChiffre1();
afficherCombinaisons2(chiffre1);
System.out.println("debut afficherCombinaisons3");
numSelect[2]=chiffre2;
int j=0, k=0, m=0, cpt=0;
for(int i=1;i<50;i++) {
if (i != chiffre1 && i!=chiffre2) {
while (combi1Id[chiffre2][j] != 0){
while (numId[i][k] != 0) {
//System.out.println(numId[i][k] +"=="+ combi1Id[chiffre2][j]);
if (numId[i][k] == combi1Id[chiffre2][j]) {
combi2Cpt[i]++;
combi2Id[i][cpt++]=numId[i][k];
}
k++;
}
k = 0;
j++;
}
j = 0;
}
cpt=0;
}
for (int i=1; i<50;i++) {
/*for (int p=1; p<50;p++) {
System.out.print(combi1Id[i][p]+", ");
}*/
System.out.println(i+": "+combi2Cpt[i]);
while(combi2Id[i][k]!=0){
System.out.print(combi2Id[i][k]+", ");
k++;
}
System.out.println();
k=0;
}
}
public void afficherBonus() throws SQLException {
System.out.println("debut afficherBonus");
int k=0, numprec=0, l=0; int k=0, numprec=0, l=0;
ResultSet rs=null; ResultSet rs=null;
String sql; String sql;
@ -185,23 +245,139 @@ public class Choix {
while (rs.next()) { while (rs.next()) {
//System.out.println(numprec+", "+rs.getInt(2)); //System.out.println(numprec+", "+rs.getInt(2));
if(numprec!=rs.getInt(2)) {k = 0;} if(numprec!=rs.getInt(2)) {k = 0;}
while(bonusid[rs.getInt(2)][k]!=0){ while(bonusId[rs.getInt(2)][k]!=0){
k++; k++;
} }
bonusid[rs.getInt(2)][k]=rs.getInt(1); bonusId[rs.getInt(2)][k]=rs.getInt(1);
System.out.println(bonusid[rs.getInt(2)][k]); System.out.println(bonusId[rs.getInt(2)][k]);
numprec=rs.getInt(2); numprec=rs.getInt(2);
} }
k=0; k=0;
//j=0; //j=0;
for (int i=1; i<11;i++) { for (int i=1; i<11;i++) {
System.out.println(i+":"); System.out.println(i+":"+bonusCpt[i][1]);
while(bonusid[i][l]!=0){ while(bonusId[i][l]!=0){
System.out.print(bonusid[i][l]+", "); System.out.print(bonusId[i][l]+", ");
l++; l++;
} }
System.out.println(); System.out.println();
l=0; l=0;
} }
} }
public void afficherNumBonus(int chiffre1) throws SQLException {
afficherChiffre1();
this.afficherBonus();
System.out.println("debut afficherNumBonus");
numSelect[1]=chiffre1;
int j=0, k=0, l=0, cpt=0;
for(int i=1;i<11;i++) {
while (numId[chiffre1][j] != 0) {
while (bonusId[i][k] != 0) {
//System.out.println(bonusId[i][k] +"=="+ numId[chiffre1][j]);
if (bonusId[i][k] == numId[chiffre1][j]) {
num1_bonusCpt[i]++;
num1_bonusId[i][cpt++]=bonusId[i][k];
j++;
}
k++;
}
k = 0;
j++;
}
j = 0;
cpt=0;
}
for (int i=1; i<11;i++) {
/*for (int p=1; p<50;p++) {
System.out.print(combi1Id[i][p]+", ");
}*/
System.out.println(i+": "+num1_bonusCpt[i]);
while(num1_bonusId[i][l]!=0){
System.out.print(num1_bonusId[i][l]+", ");
l++;
}
System.out.println();
l=0;
}
}
public void afficherNumBonusCombi2(int chiffre1, int chiffre2) throws SQLException {
afficherCombinaisons2(chiffre1);
afficherBonus();
System.out.println("debut afficherNumBonusCombi2");
numSelect[1]=chiffre1;
numSelect[2]=chiffre2;
int j=0, k=0, l=0, cpt=0;
for(int i=1;i<11;i++) {
while (combi1Id[chiffre2][j] != 0) {
while (bonusId[i][k] != 0) {
//System.out.println(bonusId[i][k] +"=="+ combi1Id[chiffre2][j]);
if (bonusId[i][k] == combi1Id[chiffre2][j]) {
num2_bonusCpt[i]++;
num2_bonusId[i][cpt++]=bonusId[i][k];
j++;
}
k++;
}
k = 0;
j++;
}
j = 0;
cpt=0;
}
for (int i=1; i<11;i++) {
/*for (int p=1; p<50;p++) {
System.out.print(combi1Id[i][p]+", ");
}*/
System.out.println(i+": "+num2_bonusCpt[i]);
while(num2_bonusId[i][l]!=0){
System.out.print(num2_bonusId[i][l]+", ");
l++;
}
System.out.println();
l=0;
}
}
public void afficherNumBonusCombi3(int chiffre1, int chiffre2, int chiffre3) throws SQLException {
afficherCombinaisons3(chiffre1, chiffre2);
afficherBonus();
System.out.println("debut afficherNumBonusCombi3");
numSelect[1]=chiffre1;
numSelect[2]=chiffre2;
numSelect[3]=chiffre3;
int j=0, k=0, l=0, cpt=0;
while (combi2Id[chiffre3][j] != 0) {
for(int i=1;i<11;i++) {
while (bonusId[i][k] != 0) {
//System.out.println(combi2Id[chiffre3][j] +"=="+ bonusId[i][k]);
if (bonusId[i][k] == combi2Id[chiffre3][j]) {
num3_bonusCpt[i]++;
num3_bonusId[i][cpt++]=bonusId[i][k];
j++;
}
k++;
}
k = 0;
}
cpt=0;
j++;
}
for (int i=1; i<11;i++) {
/*for (int p=1; p<50;p++) {
System.out.print(combi1Id[i][p]+", ");
}*/
System.out.println(i+": "+num3_bonusCpt[i]);
while(num3_bonusId[i][l]!=0){
System.out.print(num3_bonusId[i][l]+", ");
l++;
}
System.out.println();
l=0;
}
}
} }

View file

@ -18,8 +18,12 @@ public class test{
Choix c=new Choix(); Choix c=new Choix();
c.afficherChiffre1(); //c.afficherChiffre1();
//c.afficherNumBonus(); //c.afficherNumBonus();
c.afficherCombinaisons2(4); //c.afficherCombinaisons2(4);
//c.afficherNumBonus(1);
//c.afficherCombinaisons3(32,16);
c.afficherNumBonusCombi2(5,10);
//c.afficherNumBonusCombi3(28,14,37);
} }
} }