pablosotol

Codigo Java

May 24th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 7.01 KB | None | 0 0
  1. package main;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.List;
  5. import java.util.StringTokenizer;
  6.  
  7. public class Listaz {
  8.  
  9.        private List<String> lineas;
  10.        private List<Objetos> obj;
  11.        
  12.        public Listaz(){
  13.               lineas=Read.leer("C:\\Users\\pablo\\Downloads\\dataset-chilebank.csv");
  14.        }
  15.        
  16.        public void llenar(){
  17.               Objetos o;
  18.               obj=new ArrayList<Objetos>();
  19.               if(lineas!=null && !lineas.isEmpty()){
  20.               for(String linea: lineas){
  21.               StringTokenizer st=new StringTokenizer(linea, ";");
  22.               o=new Objetos();
  23.               while(st.hasMoreTokens()){
  24.                                 o.setid(st.nextToken());
  25.                                 o.setedad(st.nextToken());
  26.                                 o.setNedu(st.nextToken());
  27.                                 o.setact(st.nextToken());
  28.                                 o.setRentafija(st.nextToken());
  29.                                 o.setlimitemax(st.nextToken());
  30.                                 o.setdeuda(st.nextToken());
  31.                                 o.setporcentaje(st.nextToken());
  32.                                 o.setNcompras(st.nextToken());
  33.                                 o.sett1(st.nextToken());
  34.                                 o.sett2(st.nextToken());
  35.                                 o.sett3(st.nextToken());
  36.                                 o.setestado(st.nextToken());
  37.                                 o.setatrasos(st.nextToken());
  38.                                 o.setcompras(st.nextToken());
  39.                    
  40.                    
  41.               }
  42.                   obj.add(o);
  43.               }
  44.          
  45.               }
  46.                                  
  47.        }
  48.        
  49.        public void deuda(){
  50.               int c=0;
  51.               if(obj!=null && !obj.isEmpty()){
  52.                  for(Objetos o: obj){
  53.                      if(o.getestado().equals("SIN DEUDA")){
  54.                          c++;
  55.                      }
  56.                      
  57.                  }
  58.               }
  59.               System.out.println("La cantidad de personas con deudas son: "+c);
  60.        }
  61.        
  62.        public void titulo(){
  63.               int c=0;
  64.               if(obj!=null && !obj.isEmpty()){
  65.                  for(Objetos o: obj){
  66.                      if(o.getnedu().equals("EDUC. UNIVERSITARIA")){
  67.                         if(o.getact().equals("DEPENDIENTE")){
  68.                             if(o.getestado().equals("SIN DEUDA")){
  69.                             c++;
  70.                             }
  71.                  
  72.                      }
  73.                      
  74.                  }
  75.               }
  76.              
  77.        }  
  78.                System.out.println("La cantidad de personas dependiente con educacion universitaria y sin deudas son: "+c);
  79. }
  80.           public void cupo(){
  81.               int c=0;
  82.               if(obj!=null && !obj.isEmpty()){
  83.                  for(Objetos o: obj){
  84.                      if(o.getnedu().equals("EDUC. UNIVERSITARIA")){
  85.                         if(o.getact().equals("EMPRESARIO")){
  86.                             if(o.getcompra().equals("NO")){
  87.                                c++;
  88.                             }
  89.                          
  90.                      }
  91.                      
  92.                  }
  93.               }
  94.              
  95.        }
  96.               System.out.println("La cantidad de personas dependiente con educacion universitaria y sin deudas son: "+c);
  97. }
  98.            public void estudiante(){
  99.               int c=0;
  100.            
  101.               if(obj!=null && !obj.isEmpty()){
  102.                  for(Objetos o: obj){
  103.                        if(o.getnedu().equals("ESTUDIANTE UNIVERSITARIO")){
  104.                           if(Integer.parseInt(o.getedad())>25){
  105.                              if(o.getestado().equals("SIN DEUDA")){
  106.                                 c++;
  107.                          
  108.                              
  109.                           }
  110.                                
  111.                           }
  112.                      
  113.                  }
  114.               }
  115.              
  116.               System.out.println("La cantidad de estudiantes mayores a 25 y sin deuda son: "+c);
  117.        }
  118.              
  119. }
  120.            
  121.          public void estudiante1(){
  122.                 int c=0;
  123.                 if(obj!=null && !obj.isEmpty()){
  124.                     for(Objetos o: obj){
  125.                         if(o.getnedu().equals("ESTUDIANTE UNIVERSITARIO")){
  126.                            if(o.getcompra().equals("NO")){
  127.                               c++;
  128.                            }
  129.                         }
  130.                     }
  131.                 }
  132.                
  133.                 System.out.println("La cantidad de estudiantes casados y con cupo 0 son: "+c);
  134.          }
  135.          
  136.          public void empresarios(){
  137.              int c=0;
  138.              if(obj!=null & !obj.isEmpty()){
  139.                  for(Objetos o: obj){
  140.                      if(o.getact().equals("EMPRESARIO")){
  141.                          if(Integer.parseInt(o.getdeuda())>1000000){
  142.                             c++;
  143.                          }
  144.                      }
  145.                  }
  146.              }
  147.              System.out.println("La cantidad de empresarios con deuda superior a un millon es: "+c);
  148.          }
  149.          
  150.          public void empresarios1(){
  151.                 int c=0;
  152.                 if(obj!=null && !obj.isEmpty()){
  153.                     for(Objetos o: obj){
  154.                         if(o.getact().equals("EMPRESARIO")){
  155.                            if(Integer.parseInt(o.getdeuda())>0){
  156.                                c++;
  157.                            }
  158.                         }
  159.                     }
  160.                 }
  161.                 System.out.println("La cantidad de empresarios con deuda son: "+c);
  162.          }
  163.          
  164.             public void empresarios2(){
  165.                 int c=0;
  166.                 if(obj!=null && !obj.isEmpty()){
  167.                     for(Objetos o: obj){
  168.                         if(o.getact().equals("EMPRESARIO")){
  169.                            if(Integer.parseInt(o.getdeuda())<1000000){
  170.                                if(Integer.parseInt(o.getdeuda())>0){
  171.                                c++;
  172.                            }
  173.                         }
  174.                     }
  175.                 }
  176.                 System.out.println("La cantidad de empresarios con deuda inferior a 1 millon son: "+c);
  177.          }
  178.            
  179.          }
  180.          
  181.               public void empresarios3(){
  182.                 int c=0;
  183.                 if(obj!=null && !obj.isEmpty()){
  184.                     for(Objetos o: obj){
  185.                         if(o.getact().equals("EMPRESARIO")){
  186.                            if(o.getestado().equals("SIN DEUDA")){
  187.                                c++;
  188.                            }
  189.                         }
  190.                     }
  191.                 }
  192.                 System.out.println("La cantidad de empresarios sin deuda es de: "+c);
  193.          }
  194.            
  195.      
  196.          
  197.            
  198.                
  199.          }
Advertisement
Add Comment
Please, Sign In to add comment