Bueno tio .... analiza lo que hice ... trate de entenderte pero no eres muy especifico
acomodalo a tu necesidad
Código C++:
Ver originalpublic class Estructura {
private int enero;
private int febrero;
private int marzo;
private int abril;
private int mayo;
private int junio;
private int julio;
private int agosto;
private int septiembre;
private int octubre;
private int noviembre;
private int diciembre;
public Estructura(int enero, int febrero, int marzo, int abril, int mayo, int junio, int julio, int agosto, int septiembre, int octubre, int noviembre, int diciembre) {
this.enero = enero;
this.febrero = febrero;
this.marzo = marzo;
this.abril = abril;
this.mayo = mayo;
this.junio = junio;
this.julio = julio;
this.agosto = agosto;
this.septiembre = septiembre;
this.octubre = octubre;
this.noviembre = noviembre;
this.diciembre = diciembre;
}
public int getEnero() {
return enero;
}
public int getFebrero() {
return febrero;
}
public int getMarzo() {
return marzo;
}
public int getAbril() {
return abril;
}
public int getMayo() {
return mayo;
}
public int getJunio() {
return junio;
}
public int getJulio() {
return julio;
}
public int getAgosto() {
return agosto;
}
public int getSeptiembre() {
return septiembre;
}
public int getOctubre() {
return octubre;
}
public int getNoviembre() {
return noviembre;
}
public int getDiciembre() {
return diciembre;
}
}
Código C++:
Ver originalpublic class main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int total=0;
Estructura[] estructura= new Estructura[5];
estructura[0]= new Estructura(120,130,198,138,102,106,102,106,198,152,106,168);
estructura[1]= new Estructura(132,172,100,196,168,195,143,147,105,152,187,201);
estructura[2]= new Estructura(142,168,165,187,179,176,106,153,144,164,146,245);
estructura[3]= new Estructura(102,149,106,105,106,168,184,174,165,109,102,204);
estructura[4]= new Estructura(132,145,197,136,146,102,130,100,165,132,185,201);
//Totales en el mes de Enero de los 5 Vendedores
for (int i = 0; i < estructura.length; i++) {
total=total+estructura[i].getEnero();
}
System.out.println("El total de ventas en el Mes de enero de los venderoes es: "+total);
//Total de ventas en todos lo meses por vendedor
for (int i = 0; i < estructura.length; i++) {
total=estructura[i].getEnero()+estructura[i].getFebrero()+estructura[i].getMarzo()+estructura[i].getAbril()+estructura[i].getMayo()+estructura[i].getJunio()+estructura[i].getJulio()+estructura[i].getAgosto()+estructura[i].getSeptiembre()+estructura[i].getOctubre()+estructura[i].getNoviembre()+estructura[i].getDiciembre();
System.out.println("El vendedor "+(i+1)+" vendio en todo el año: "+total);
}
for (int i = 0; i < estructura.length; i++) {
}
}
}