Ver Mensaje Individual
  #6 (permalink)  
Antiguo 01/10/2012, 20:42
AdvKael
 
Fecha de Ingreso: febrero-2012
Mensajes: 136
Antigüedad: 12 años, 2 meses
Puntos: 8
Respuesta: laguien me puede ayudar con este ejercicio .!:! importante

Bueno tio .... analiza lo que hice ... trate de entenderte pero no eres muy especifico
acomodalo a tu necesidad

Código C++:
Ver original
  1. public class Estructura {
  2.     private int  enero;
  3.     private int febrero;
  4.     private int marzo;
  5.     private int abril;
  6.     private int mayo;
  7.     private int junio;
  8.     private int julio;
  9.     private int agosto;
  10.     private int septiembre;
  11.     private int octubre;
  12.     private int noviembre;
  13.     private int diciembre;
  14.  
  15.     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) {
  16.         this.enero = enero;
  17.         this.febrero = febrero;
  18.         this.marzo = marzo;
  19.         this.abril = abril;
  20.         this.mayo = mayo;
  21.         this.junio = junio;
  22.         this.julio = julio;
  23.         this.agosto = agosto;
  24.         this.septiembre = septiembre;
  25.         this.octubre = octubre;
  26.         this.noviembre = noviembre;
  27.         this.diciembre = diciembre;
  28.     }
  29.  
  30.     public int getEnero() {
  31.         return enero;
  32.     }
  33.  
  34.     public int getFebrero() {
  35.         return febrero;
  36.     }
  37.  
  38.     public int getMarzo() {
  39.         return marzo;
  40.     }
  41.  
  42.     public int getAbril() {
  43.         return abril;
  44.     }
  45.  
  46.     public int getMayo() {
  47.         return mayo;
  48.     }
  49.  
  50.     public int getJunio() {
  51.         return junio;
  52.     }
  53.  
  54.     public int getJulio() {
  55.         return julio;
  56.     }
  57.  
  58.     public int getAgosto() {
  59.         return agosto;
  60.     }
  61.  
  62.     public int getSeptiembre() {
  63.         return septiembre;
  64.     }
  65.  
  66.     public int getOctubre() {
  67.         return octubre;
  68.     }
  69.  
  70.     public int getNoviembre() {
  71.         return noviembre;
  72.     }
  73.  
  74.     public int getDiciembre() {
  75.         return diciembre;
  76.     }
  77.    
  78.    
  79.  
  80.    
  81.  
  82.        
  83. }


Código C++:
Ver original
  1. public class main {
  2.  
  3.    
  4.     /**
  5.      * @param args the command line arguments
  6.      */
  7.     public static void main(String[] args) {
  8.         // TODO code application logic here
  9.         int total=0;
  10.         Estructura[] estructura= new Estructura[5];
  11.         estructura[0]= new Estructura(120,130,198,138,102,106,102,106,198,152,106,168);
  12.         estructura[1]= new Estructura(132,172,100,196,168,195,143,147,105,152,187,201);
  13.         estructura[2]= new Estructura(142,168,165,187,179,176,106,153,144,164,146,245);
  14.         estructura[3]= new Estructura(102,149,106,105,106,168,184,174,165,109,102,204);
  15.         estructura[4]= new Estructura(132,145,197,136,146,102,130,100,165,132,185,201);
  16.        
  17.         //Totales en el mes de Enero de los 5 Vendedores
  18.         for (int i = 0; i < estructura.length; i++) {
  19.             total=total+estructura[i].getEnero();
  20.         }
  21.         System.out.println("El total de ventas en el Mes de enero de los venderoes es: "+total);
  22.    
  23.         //Total de ventas en todos lo meses por vendedor
  24.         for (int i = 0; i < estructura.length; i++) {
  25.             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();
  26.             System.out.println("El vendedor "+(i+1)+" vendio en todo el año: "+total);
  27.         }
  28.        
  29.         for (int i = 0; i < estructura.length; i++) {
  30.            
  31.            
  32.         }
  33.        
  34.     }    
  35. }