programacion de computadores Lectura 3 - Elementos Formales Del Lenguaje Java II

download programacion de computadores Lectura 3 - Elementos Formales Del Lenguaje Java II

of 5

Transcript of programacion de computadores Lectura 3 - Elementos Formales Del Lenguaje Java II

  • 8/18/2019 programacion de computadores Lectura 3 - Elementos Formales Del Lenguaje Java II

    1/5

    !"#$%& ($)*+,- .%+%/0# 1%##0#%

    !" #$%&%'()* ,)-&.$%* /%$ $%'01.2% 3.4. 5667

    "# $%&$ '()*+$#&( ,('-.% $#)(#&-/- 0#1(-+/)02# -$3/)0(#/'/ )(# 3/ %0#&/40% 5$#$-/3#$)$%/-0/ ,/-/ 3/ )(#%&-*))02# '$ ,-(5-/+/% $# 6/7/ 8/%/'(% $# )(#'0)0(#$% 9/%05#/)0(#$%:

    !"8 9%:-%*%'(.;$)*&$ ( #(< *# )(#>*#&( '$ 0#%&-*))0(#$%: ?$ /)*$-'( )(# $%&(< ,('$+(% 1(-+/30@/- %* $%)-0&*-/ $# $3 3$#5*/>$ 6/7/ '$ 3/ %05*0$#&$ 1(-+/A

    01BC"4,-$%02# 8((3$/#/DEF::

    :G

    H0 -$=*$-0+(% &$#$- $# )*$#&/ $3 )/%( $# $3 =*$ #( %$ )*+,3/ 3/ )(#'0)02#< I/-$+(% 3(%05*0$#&$A

    01BC"4,-$%02# 8((3$/#/DEF:::

    G $3%$ F:::

    G

    J$#5/+(% $# )*$#&/ =*$ #( *%/+(% ,*#&( 9 )(+/ BKE ,/-/ '$10#0- 3/ &$-+0#/)02# '$ *#83(=*$ )(#'0)0(#/3< '/'( =*$ $%&/ '$10#0)02# %$ I/)$ )(# )(-)I$&$%:

    ?$#&-( '$ )/'/ ,/- '$ )(-)I$&$% %$ ,*$'$ '$10#0- *# )(#>*#&( /-80&-/-0( '$ 0#%&-*))0(#$%'$ /)*$-'( )(# 3/% &/-$/% =*$ %$ '$8/# -$/30@/-K $%&/% 0#%&-*))0(#$% ,*$'$# %$- 0#)3*%((&-/% )(#'0)0(#$% ( )*/3=*0$- $3$+$#&( '$ )(#&-(3 =*$ )(#(@)/+(% +.% /'$3/#&$: L +('('$ $>$+,3(< 7$/+(% 3/ -$,-$%$#&/)02# $# 3$#5*/>$ 6/7/< '$3 $>$-)0)0( -$%*$3&( $# 3/ 3$)&*-/M '$3 )*-%(A

    POLITÉCNICO GRANCOLOMBIANO EN ALIANZA CON WHITNEY INTERNAT

  • 8/18/2019 programacion de computadores Lectura 3 - Elementos Formales Del Lenguaje Java II

    2/5

    !"#$%& ($)*+,- .%+%/0# 1%##0#%

    L35(-0&+( Descuentos

    "#&-/'/%

    libros, cuadernos, lapices: Entero

    total: Real

    N-$A{libros>=0 Y cuadernos>=0 Y lapices>=0 Y total>= 0}

    O#0)0(

    totalConDescuento ! total

    si(libros>3 O cuadernos>6) entonces

    inicio_si

    totalConDescuento ! total*0.75

    sino

    si((libros=1 O libros=2) Y cuadernos>3 Y lapices>=4) entonces

    inicio_si

    totalConDescuento ! total*0.85

    fin_si

    fin_si

    P0#

    H/30'/%

    totalConDescuento: Real

    N(%A{totalConDescuento >= 0 Y totalConDescuento 3 || cuadernos>6){

  • 8/18/2019 programacion de computadores Lectura 3 - Elementos Formales Del Lenguaje Java II

    3/5

    !"#$%& ($)*+,- .%+%/0# 1%##0#%

    totalConDescuento = total*0.75;

    } else {

    if ((libros==1 || libros==2) && cuadernos>3 && lapices>=4){

    totalConDescuento = total*0.85;

    }

    }

    !"> ?$)@1%* ;)'//- '$ *%/-)(-)I$&$%: N(- $>$+,3(A

    if (x>3 || y>6)total = 185;

    elsetotal = 192;

    "%&( -$'*)$ $3 &/+/Q( '$3 )2'05(< ,$-( +*)I/% 7$)$%< /3 =*$-$- /Q/'0- +.% 0#%&-*))0(#$%B$#verde E /3 83(=*$ )(#'0)0(#/3< (370'/+(% 0#)3*0- 3(% )(-)I$&$%< 0#)*--0$#'( $# $--(-$%)(+( $%&$A

    ! 6';)--%;()

    " A)--%;()

    if (x>3 || y>6)

    total = 185;

    total2 = 134;

    else

    total = 192;

    z = 16;

    total = total * z + 18;

    if (x>3 || y>6){

    total = 185;

    total2 = 134;

    } else {

    total = 192;

    z = 16;

    total = total * z + 18;

    }

  • 8/18/2019 programacion de computadores Lectura 3 - Elementos Formales Del Lenguaje Java II

    4/5

    !"#$%& ($)*+,- .%+%/0# 1%##0#%

    ! 6';)--%;() " A)--%;() if (x>7)

    total = 45;

    else

    total = 46;

    q = 170;

    "%&$ )/%( $% +.% )(+,30)/'( '$ )(--$50-< '/'( =*$/3 )2'05( )(+,03/< ,$-( 3/ 3R#$/ '$ )2'05(

    q = 170; %0$+,-$ %$ $>$)*&/< ,(- =*$'/- 1*$-/'$3 83(=*$ if :

    if (x>7){

    total = 45;

    } else {

    total = 46;

    q = 170;

    }

    N(- %0&*/)0(#$% )(+( $%&/< %$ -$)(+0$#'/ *%/- %0$+,-$ )(-)I$&$% ,/-/ '$10#0- )3/-/+$#&$'2#'$ )(+0$#@/ 9 '(#'$ &$-+0#/ 3/ '$10#0)02# '$ *# 83(=*$:

    !"B ?$)@1%* /% *%$%;;

  • 8/18/2019 programacion de computadores Lectura 3 - Elementos Formales Del Lenguaje Java II

    5/5

    !"#$%& ($)*+,- .%+%/0# 1%##0#%

    '$1/*3&AWWO#%&-*))0(#$% %0 #( %$ '/ #0#5Z# )/%(8-$/XK

    G

    "# $%&$ )/%(< 3/ $4,-$%02# 0#0)0/3 %$ $7/3Z/< 9 '$ /)*$-'( )(# $3 -$%*3&/'(< %$ $>$)*&/ $3)(#>*#&( '$ 0#%&-*))0(#$% '$10#0'( ,/-/ *# )/%( B case E ,/-&0)*3/-: "% 0+,(-&/#&$ &$#$- $#)*$#&/ =*$ '0)I( )(#>*#&( '$ 0#%&-*))0(#$% #( %$ '$30+0&/ *%/#'( )(-)I$&$%<%0+,3$+$#&$ %$ -(+,$ 3/ $>$)*)02# *%/#'( 3/ $4,-$%02# break : P0#/3+$#&$< %0 #( %$ '/#0#5Z# )/%(< $% ,(%083$ '$10#0- *# )(+,(-&/+0$#&( ,(- '$1$)&( *%/#'( 3/ ,/3/8-/default :

    U$/+(% $3 )2'05( $# 6/7/ '$3 $>$+,3( ,-$%$#&/'( $# 3/ 3$)&*-/ MAswitch (selección){

    case 1:

    resultado = a+b;

    case 2:

    resultado = a-b;

    case 3:

    resultado = a*b;

    case 4:

    resultado = a/b;

    default :

    resultado = 0;

    }