Advertisement
kernel_memory_dump

Untitled

May 15th, 2015
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 KB | None | 0 0
  1. public class NegativnaJacinaZvukaException  extends RuntimeException {
  2.  
  3.    public NegativnaJacinaZvukaException() {
  4.                   super();
  5.   }
  6.  
  7.   public NegativnaJacinaZvukaException(String poruka) {
  8.                super(poruka);
  9.   }
  10.  
  11. }
  12.  
  13. public class Televizor {
  14.     int trenutniKanal;
  15.     final int MAX_KANAL = 255;
  16.     final int jacinaZvuka;
  17.     boolean ukljucen =  false;
  18.      
  19.      
  20.     public int pojacajZvuk(int zaKoliko) throws NijeUkljucenException {
  21.               ukljucen = true;
  22.        if ( !ukljucen) {
  23.             NijeUkljucenException  izuzetak = new NijeUkljucenException("TV NIJE UKLJUCEN!");
  24.             throw  izuzetak;
  25.       }  
  26.      
  27.     if( (zaKoliko < 0){
  28.              throw new NegativnaJacinaZvukaException("Ne moze zvuk da bude negativan!!!");
  29.      
  30.     }
  31.      
  32.            jacinaZvuka += zaKoliko;
  33.            return jacinaZvuka;
  34.      
  35.      
  36.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement