How to make the same button insert three different data to three variables

0

I am programming a scientific calculator and I am in the key to convert a data of degrees, minutes and seconds, a number with decimals.

Therefore I have a single button and first I must enter a number by degrees (Pe) 73 degrees, then insert the number of minutes (Pe) 21, taxes and then the seconds (Pe) 44.6832 and combining the three figures when pressing the ¨igual ¨ roof it should give a result with a formula 73.362412 the formula is simple but what I am not achieving is to be able to insert the three numbers with the same button.

I tried it with an integer control variable and these two screens handling one that collects the inserted data and another one that shows the result

 case R.id.btndms:
                int dms1=0;
                    if (dms1==0){numero[0]=Double.parseDouble(a);
                    dms1++;
                    pantalla1.setText(numero[0]+"d");
                    pantalla.setText("");
                    }
                    else if (dms1==1){numero[1]=Double.parseDouble(b);
                    dms1++;
                    pantalla1.setText(numero[0]+"d"+numero[1]+"m");
                    pantalla.setText("");
                    }
                    else if (dms1==2){numero[2]=Double.parseDouble(c);
                    dms1++;
                    pantalla1.setText(numero[0]+"d"+numero[1]+"m"+numero[2]+"s");
                    pantalla.setText("");
                    decimal = false;
                    }
                break;


}   else if (dms == true){
                    resultado = numero[0]+(numero[1]*60)+(numero[2]*3600);
                    pantalla.setText(String.valueOf( resultado));
                    decimal = true;

here is my code

    
asked by Jorge Pedro 25.11.2018 в 20:38
source

0 answers