Advertisement
Guest User

Untitled

a guest
Nov 12th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.93 KB | None | 0 0
  1. private int imei, numero, minutos, megas, saldo;
  2.     private boolean ocupePrestaLuca;
  3.    
  4.     public boolean prestaLuca(){
  5.         if(saldo < 100 && !ocupePrestaLuca){
  6.             saldo = saldo + 1000;
  7.             ocupePrestaLuca = true;
  8.             return true;
  9.         }
  10.        
  11.         return false;
  12.     }
  13.    
  14.     public void reiniciarContadores(){
  15.         minutos = 0; megas = 0;
  16.     }
  17.    
  18.     public boolean cargar(int monto){
  19.         if(monto >= 1500){
  20.             saldo = saldo + monto;
  21.             if(ocupePrestaLuca){
  22.                 saldo = saldo - 1000;
  23.                 ocupePrestaLuca = false;
  24.             }
  25.             return true;
  26.         }
  27.         return false;
  28.     }
  29.    
  30.     public boolean navegar(int meg){
  31.         int necesito = meg * 7;
  32.         boolean ok = false;
  33.        
  34.         if(meg > 0 && saldo >= necesito){
  35.             saldo = saldo - necesito;
  36.             megas = megas + meg;
  37.             ok = true;
  38.         }
  39.        
  40.         return ok;
  41.     }
  42.    
  43.     public boolean llamar(int minutos){
  44.         int necesito = minutos * 30;
  45.         boolean ok = false;
  46.        
  47.         if(minutos > 0 && saldo >= necesito){
  48.             saldo = saldo - necesito;
  49.             this.minutos = this.minutos + minutos;
  50.             ok = true;
  51.         }
  52.        
  53.         return ok;
  54.     }
  55.    
  56.    
  57.     public Celular(int iMei){
  58.         imei = iMei;
  59.     }
  60.    
  61.     public Celular(int iMei, int saldoInicial){
  62.         imei = iMei;
  63.         if(saldoInicial > 0)
  64.             saldo = saldoInicial;
  65.        
  66.     }
  67.  
  68.     public void setNumero(int numero) {
  69.         this.numero = numero;
  70.     }
  71.    
  72.     public int getImei() {
  73.         return imei;
  74.     }
  75.  
  76.     public int getNumero() {
  77.         return numero;
  78.     }
  79.  
  80.     public int getMinutos() {
  81.         return minutos;
  82.     }
  83.  
  84.     public int getMegas() {
  85.         return megas;
  86.     }
  87.  
  88.     public int getSaldo() {
  89.         return saldo;
  90.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement