1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57

case states . FIRST_ARG_FLOAT : if ( key_class === kclass . NUM ){ this . dispAppend ( key ); this . state = states . FIRST_ARG_FLOAT ; } if ( key_class === kclass . OP ){ this . op = key ; //store value of the disp in a acc1 variable in order to be able to store second number in the disp this . acc1 = this . disp ; this . state = states . OP ; } if ( key_class === kclass . CE ){ this . dispSet ( "0" ); calc . state = states . START ; } break ; case states . OP : if ( key_class === kclass . NUM ){ this . dispSet ( key ); this . state = states . SECOND_ARG ; } if ( key_class === kclass . DOT ){ this . dispSet ( "0." ); this . state = states . SEC_ARG_DOT ; } break ; case states . SECOND_ARG : if ( key_class === kclass . DOT ){ this . dispAppend ( key ); this . state = states . SEC_ARG_FLOAT ; } if ( key_class === kclass . NUM ){ this . dispAppend ( key ); this . state = states . SECOND_ARG ; } if ( key_class === kclass . EQ ){ //store the second number in the acc2 variable so that we can use it if the equal sign is pressed more than once this . acc2 = this . disp ; //calculate the result this . operation ( this . acc1 , this . disp ); this . displayUpdate ( this . disp ); this . state = states . EQ ; } if ( key_class === kclass . OP ){ //calculate the result this . operation ( this . acc1 , this . disp ); this . op = key ; //store the result of the operation in the acc1 in order to be used in the next operation this . acc1 = this . disp ; this . displayUpdate ( this . disp ); this . state = states . OP ; } if ( key_class === kclass . CE ){ this . dispSet ( "0" ); calc . state = states . OP ; } break ;