Advertisement
fmbalvarez

Guía 5 - Ejercicio 1 y 2 - Nota

Sep 26th, 2014
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.53 KB | None | 0 0
  1.  
  2. class Nota {
  3.    
  4.     int valorInicial;
  5.    
  6.     Nota(int valorInicial){
  7.        
  8.         if (valorInicial >= 0 && valorInicial <=10){
  9.            
  10.             this.valorInicial = valorInicial;
  11.            
  12.         }
  13.        
  14.     }
  15.    
  16.     int getValor(){
  17.        
  18.         return valorInicial;
  19.        
  20.     }
  21.    
  22.     boolean aprobado(){
  23.        
  24.         return (valorInicial >= 4);
  25.        
  26.     }
  27.    
  28.     boolean desaprobado(){
  29.        
  30.         return (valorInicial <= 4);
  31.        
  32.     }
  33.    
  34.     void recuperar(int nuevoValor){
  35.        
  36.         if (nuevoValor > valorInicial && nuevoValor > 0 && nuevoValor < 10){
  37.            
  38.             valorInicial = nuevoValor;
  39.            
  40.         }
  41.     }
  42.    
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement