TUGAS PBO REMOT TV



NAMA : ZAHRUL ZIZKI DINANTO
KELAS : PBO B
NRP      : 05111740000168




Berikut adalah struktur : 



Berikut adalah Source Code :

CLASS

  
    import java.util.Scanner;   
 /**  
  * Source Code Remot TV  
  *  
  * @author (ZAHRUL ZIZKI DINANTO)  
  * @version (8.1/20092018)  
  */  
 public class Remot  
 {  
   private int volume;  
   private int channel;  
   private int cadang;
   public Remot(int volumeini,int chanelini){  
     volume = volumeini;  
     channel = chanelini;  
   }  
  
   public void plusVolume()  
   {  
     
     volume= volume+1;  
     System.out.println("Volumenya Saat ini : "+volume);  
   
   }  
   public void minVolume()  
   {  
     if(volume == 0){  
       System.out.println("Volumenya 0 ");  
     }  
     else{  
     volume= volume-1;  
     System.out.println("Volumenya Saat ini : "+volume);  
   }  
   }  
   public int plusChannel()  
   {  
     channel = channel+1;  
     return channel;  
   }  
   public int minChannel()  
   {  
     channel = channel-1;  
     return channel;  
   }  
   public int mute(){
       if(volume != 0){  
      cadang = volume;
      volume = 0;
    
       System.out.println("Volume Telah Di Nol kan "); 
       
       System.out.println("volume saat ini = "+volume); 
       return volume;
     }  
     else{  volume = cadang;
        cadang = 0;
        
       System.out.println("Volume Telah Di Kembalikan "); 
       
       System.out.println("volume saat ini = "+volume); 
       return volume;
   }  }
        
   
 }  

MAIN


         import java.util.Scanner;   
 /**  
  * Source Code Menjalankan Remot TV  
  *  
  * @author (ZAHRUL ZIZKI DINANTO)  
  * @version (8.2/20092018)  
  */  
 public class Main  
 {  
   public static void main(String args[]){    
    Scanner scan= new Scanner(System.in);    
    int volumeini,chanelini, menu ,cadangvol=0,loop=1;    
    System.out.println("###########################");  
    System.out.println("#                         #");
    System.out.println("#                         #");
    System.out.println("#     SAMSUL SMART TV     #");
    System.out.println("#                         #");
    System.out.println("#                         #");
    System.out.println("###########################");  
    
    System.out.println("Masukkan Volume Saat Ini : ");    
    volumeini = scan.nextInt();   
    System.out.println("##################=");  
    System.out.println("Masukkan Channel Saat Ini : ");    
    chanelini = scan.nextInt();   
    System.out.println("##################");  
    Remot KS = new Remot(volumeini,chanelini);   
 
    while(loop==1) {   
     System.out.println("Daftar Menu :");   
     System.out.println("1. Volume Saat Ini");    
     System.out.println("2. Channel Saat Ini");    
     System.out.println("3. Ganti Channel");   
     System.out.println("4. Naikkan Channel");  
     System.out.println("5. Turunkan Channel");  
     System.out.println("6. Naikkan Volume");   
     System.out.println("7. Turunkan Volume"); 
     System.out.println("8. Nol kan suara/kembalikan");  
     System.out.println("9. Exit");   
     System.out.println("Menu Yang Dipilih : ");  
     menu=scan.nextInt();    
     System.out.println("##################=");  
     switch(menu){    
      case 1:    
       System.out.println("Volume Saat Ini : "+volumeini);   
       System.out.println("##################=");  
       break;   
      case 2:    
       if(chanelini == 1){  
         System.out.println("##################=");  
         System.out.println("============NET.TV===========");  
         System.out.println("====Channel Saat ini : "+chanelini+"=======");   
         System.out.println("##################");  
       }  
       else if(chanelini == 2){  
         System.out.println("##################");  
         System.out.println("==========METRO.TV===========");  
         System.out.println("====Channel Saat ini : "+chanelini+"=======");   
         System.out.println("##################");  
       }  
       else{  
         System.out.println("##################");  
         System.out.println("=============BLUE SCREEN==============");  
         System.out.println("====Channel Saat ini : "+chanelini+"=======");   
         System.out.println("##################");  
     }  
       break;  
       
       case 3:
     chanelini = scan.nextInt();
         if(chanelini == 1){  
         System.out.println("##################");  
         System.out.println("============NET.TV===========");  
         System.out.println("====Channel Saat ini : "+chanelini+"=======");   
         System.out.println("##################");  
       }  
       else if(chanelini == 2){  
         System.out.println("##################");  
         System.out.println("==========METRO.TV===========");  
         System.out.println("====Channel Saat ini : "+chanelini+"=======");   
         System.out.println("##################");  
       }  
       else{  
         System.out.println("##################");  
         System.out.println("=============BLUE SCREEN==============");  
         System.out.println("====Channel Saat ini : "+chanelini+"=======");   
         System.out.println("##################");  
     }  
     break;
      case 4:    
       chanelini = chanelini+1;   
       if(chanelini == 1){  
         System.out.println("##################");  
         System.out.println("============NET.FTV===========");  
         System.out.println("====Channel Saat ini : "+chanelini+"=======");   
         System.out.println("##################");  
       }  
       else if(chanelini == 2){  
         System.out.println("##################");  
         System.out.println("==========METRO.TV===========");  
         System.out.println("====Channel Saat ini : "+chanelini+"=======");   
         System.out.println("##################");  
       }  
       else{  
         System.out.println("##################");  
         System.out.println("=============BLUE SCREEN==============");  
         System.out.println("====Channel Saat ini : "+chanelini+"=======");   
         System.out.println("##################");  
     }  
       break;   
      case 5:    
       chanelini = chanelini-1;  
       if(chanelini == 1){  
         System.out.println("##################");  
         System.out.println("============TC'S FTV===========");  
         System.out.println("====Channel Saat ini : "+chanelini+"========");   
         System.out.println("##################");  
       }  
       else if(chanelini == 2){  
         System.out.println("##################");  
         System.out.println("==========TC'S SPORT===========");  
         System.out.println("====Channel Saat ini : "+chanelini+"=======");   
         System.out.println("##################");  
       }  
       else{  
         System.out.println("##################");  
         System.out.println("=============BLUE SCREEN==============");  
         System.out.println("====Channel Saat ini : "+chanelini+"=======");   
         System.out.println("##################");  
     }  
       break;   
       
      case 6:    
       KS.plusVolume();  
       break;   
      case 7:    
       KS.minVolume();   
       break;  
      case 8:
      KS.mute();  
        break;
      case 9:   
       System.out.println("TV Non-Aktif");  
      loop = 0;   
       break;   
       
        
     }
    
    }   
   }   
 }  

SCREENSHOOT PROGRAM :






Komentar

Postingan populer dari blog ini

PBO-B fox and rabbit