simulador radio

package radio2fm; import java.util.Scanner; public class Radio2Fm { public void emisora(float e){ Scanner sc = new Scanner(; System.out.println("\nIntroduzca la emisora deseada:"); e = sc.nextFloat(); System.out.println("\nHa sintonizado "+ e + "Fm"); } public void volumen(int v){ Scanner sc = new Scanner(; System.out.println("\nDigite el volumen deseado, entre 0 y 100"); v = sc.nextInt(); if(v>100){ System.out.print("\n^^^^^^Esta configurcion no esta admiida por el sistema.^^^^^\n"); }else{ System.out.println("\nEl volumen esta al "+ v + "%"); } } public static void main (String args[]){ Scanner sc = new Scanner(; int opcion=0, i=0, v=0; float e=0; System.out.println("Radio encendida!"); while (opcion<3){ System.out.println("\nSeleccione la opcion deseada: "); System.out.println("1.Cambiar emisora."); System.out.println("2.Cambiar volumen."); System.out.println("3.Apagar radio."); opcion=sc.nextInt(); switch(opcion){ case 1: Radio2Fm emisora = new Radio2Fm(); emisora.emisora(e); break; case 2: Radio2Fm volumen = new Radio2Fm(); volumen.volumen(v); break; } } } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.