home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 21 / IOPROG_21.ISO / SOFT / CODICE / JAVA.ZIP / Televisore.java < prev   
Encoding:
Text File  |  1998-11-15  |  462 b   |  26 lines

  1. class Televisore {
  2.  
  3.     int volume = 10;
  4.  
  5.     void alzaVolume(int v){
  6.         System.out.println("(Alziamo il volume)");
  7.         volume = volume + v;
  8.     }
  9.  
  10.     void abbassaVolume(int v){
  11.         System.out.println("(Abbassiamo il volume)");
  12.         volume = volume - v;
  13.     }
  14.  
  15.     void ascolta() {
  16.  
  17.         if (volume <= 0)
  18.             System.out.println("...");
  19.         else if (volume <= 10)
  20.             System.out.println("blah, blah, blah...");
  21.         else
  22.             System.out.println("BLAH, BLAH, BLAH...");
  23.     }
  24. }
  25.  
  26.