Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Teleco;
- import java.io.IOException;
- public class Decibelios {
- /**
- * @param args
- */
- Decibelios d;
- //VARIABLES
- //watios
- //W,MW,DBW,DBM
- float W,MW, DBW,DBM,DBMV;
- //voltios
- //V,MV,DBV,DBMV
- public float ConversorVatios (int num) throws IOException{
- System.out.println("Numero introducido "+num);
- System.out.println("MEDIDA DE CONVERSION" +
- "1. W" +
- "2.MW" +
- "3.DBW" +
- "4.DBM");
- int opc1=Consola.leeInt();
- System.out.println("MEDIDA A CONVERTIR" +
- "1. W" +
- "2.MW" +
- "3.DBW" +
- "4.DBM");
- int opc2=Consola.leeInt();
- while (opc1!=1 || opc1!=2 || opc1!=3 || opc1!=4 || opc1!=1
- ||
- opc2!=2 || opc2!=3 || opc2!=4){
- System.out.println("Uno de los números introducidor no es correcto");
- }
- while (opc1==1 && opc2==2 || opc1==2 && opc2==2 || opc1==3 && opc2==3
- || opc1==4 && opc2==4){
- System.out.println(" No se pueden pedir dos numeros iguales");
- }
- if (opc1==1 && opc2==2) {
- W=num;
- MW=W*1000;
- System.out.println( MW +" MW ");
- }else if (opc1==2 && opc2==1){
- MW=num;
- W=MW/1000;
- System.out.println( W +" W ");
- } else if (opc1==2 && opc2==4){
- MW=num;
- DBM=(float) (10*Math.log(MW));
- System.out.println( DBM +" DBM ");
- } else if (opc1==4 && opc2==2) {
- DBM=num;
- //BASE , EXPONENTE DBM /10
- MW=(float) Math.pow(10, (DBM/10));
- System.out.println( MW +" MW ");
- } else if (opc1==1 && opc2==3){
- W=num;
- DBW=(float) (10*Math.log(W));
- System.out.println( DBW +" DBW ");
- } else if (opc1==3 && opc2==1){
- DBW=num;
- W=(float) Math.pow(10, (DBW/10));
- System.out.println( W +" W ");
- } else if (opc1==3 && opc2==4){
- DBW=num;
- DBM=DBW+30;
- System.out.println( DBM +" DBM ");
- } else if ( opc1==4 && opc2==3) {
- DBM=num;
- DBW=DBM-30;
- System.out.println( DBW +" DBW ");
- }
- return num;
- }
- /*
- *
- * if (opc1==4 && opc2==5){
- *
- * DBM=num;
- *
- * DBMV=DBM-90-10*Math.log(75);
- *
- * System.out.println( DBMV + " DBMV ");
- * }
- *
- *
- *
- *
- *
- *
- */
- public static void main(String[] args) throws IOException {
- // TODO Auto-generated method stub
- Decibelios d1=new Decibelios();
- d1.ConversorVatios(30);
- System.out.println( "HOLAA ");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment