You are on page 1of 7
amport java.io.* a a package ejercicio04: public class Bjercicion4 ( public static void main(String[] args) throvs loException ( // TODO code application logic here // oeciarar variables byes edad ~ 9; ant adadfutura = byte numero = 1 pre("ingres= vu EDAD a BufferedReader Leer ~ new BufferedReader (new InputStreanReader |Systen-i7} String ledad = Leer. readline (| edad = Byte.parseayte(Ledad) : (//comenzando 21 wails while (numero <= 12)¢ edadfutura = edad + numero; 9 de" + numero +" afio(s) sera: " + edadfutura); (/t10 odo para imprimir static void pré(String 2) ( System. out.printin(s): Resutads peckage Ejercicio0s; public cless VentanaSuna =xvends jevax.swing-JFrame { ane rot = 0: ant nro? = 0 ant suna = 07 ant muicapiicar = porlic Ventanasma() ( inaeComponents ()7 + This method is called + WARING: Do NOT modify chis code. The content of this method is always + recenerated by che Form Editor ” GSuppressWWarnings ("unchecked") private vold JButton1ActionPerformed (Java-akv-event.AccionEvent ev) { // ToDo asa your nansling case mere con within the constructor to initialize the form nroistnteger.parseint | Textrieis: .gecText () nrovsinteger.parseint | Textrieic2.gecText () ema = nest + nz02; if (euma > 20)¢ plextFielss.secText ("la ema es grande, e2! , eles w+ sume}? ‘STextField3.setTexs ("le suma cs pequelia, co: " + sume)? private void jButton2ActionPerformed (java awt event .ActionEvent evt) ¢ TODO aga y coae nrolsInteger.parseInt (3Texcfieldl.getText ()) + necdeInteger .parseInt (jTex:Field?.getText ()): estar = rol - nro2y Af (Restar > 20)¢ jiext#ie1a3.setText ("1a » else sca es grande, es: " + Restar); STextFieias.. jet Tent ("la Reova eo pequefia, co: " + Restar)s OBO aca nrolvInteger parssInt (jTextTicldl.getTeat ())+ nro2“Inveger parseInt (JTexcTield2.getText ()); Multiplicar = nrol * nro! Af (Multiplicar > 20)¢ lextField3.setText ("la Mulziplicacion ea grande, «: > ese 3TextField3.setText("la Multiplicar es pequefa, es "4 Muleiplicary; + Multaplicar) private void jButtondAationPerformed (Java aut event ReticnEvent evt) { TORO aca handling code nrolsInteger parseint (3TexcPielal.getText ()) nrodeInteger parseInt (jTex=Field?.getText ()): Dividiz = nrol / nro2; Af (Bivicis > 20)¢ JTextField3.setText ("la Division es grande, es + pavaciz): y else JTexcFields.secText ("la Division 2s psquefia, es: " + Dividiry; * @param args the command line arguments public static vorc main(String args{]) { /+ Set the Nimbus look and £ Took ana & serting cod: (7 create and aisplay the torn */ Java saws -EventQueue. invokeLeter (new Runnebl=() ¢ public void ran() ( new VentanaSume () .setVisible (true) + ne // Naziables declaration - do not modify private Javax.swing.JBucton jBuctoni, private javax.ewing.JButton jButton2? private javax.swing.JButton 38utton3: private javax.swing.JButton 3Buttoné, private Javax.swing.gLabel jLabe11; private javax.swing.JLabel 3Labe12: private javax.swing.JLabel 3Labe13: private javax.swing. TextField 3TextFisidi; private Javax.swing.JTexcFie1d jTextrisicz; private javax.swing. JTexcField 3TextFicid3; J / Bnd of variables decla: cher tapos double cantidad, precios, tipocanbic - 0.07 double dactot - 0.0; aouble Deacuent! peez( peta" ") petz(" "); Pee ("Nombre del producto ~-> "); BufferedReader leer = new EufferedReader (new InputScreamReader (System. 1) Sczing nombre = leert.reediine() angeess a2 aatosrtisseisttisserereamys Prt(*Tipo de producco [3, Lb , C GI BufferedReader leer? - new BufferedReader (new InpatScreamReades (System. in); Sceing stipe ~ lecz2.readLine(); pet ("Cencidad a comprar ===>")? BufferedReader leer3 = new SufferedReaser (nev InpstScreamReader (System. 2n))? Scring scantigad = leers.reaaLine(): prt ("Fresio univario > ")s BufferedReader lserd ~ new BufferedReader (new InputScreamReade: (System. in}) 7 Sceing epreciou ~ leer!.zeasLine ||? PeE("Tapo de cammie § Hoy “ BufteredReader Iser$ = new BufferedReader (new TnputscreanReader (Sysvem. String stipocembic ~ lesr5.readLine() conversion de tipse tipo = scapo.charat(c): preciou = Double.parseDoubls(spreciou) + cantided ~ Doubie.parseZouble(scentidad) ; ‘ipecambio ~ Double.parseDoubie(stipecanbic) + ‘apa = etipo. enazhe (9)? Eresicu = Doubie.parsepoupis (aprecno%) : canticad = poubie.parsecoupis (ecantaaad) ‘cxpocambis = Deubie.parsapounie(azapecansic) swaten (eapo) ( peta peta PEog("Juguete sa un proaucto NO EERECEELE") prog("vates ae Facturacien:")+ erg ("VALOR VENTA (5/.)t " $ eantagactpreezos) 7 PECE("YALOR VENTA (6)! " + (Cantagaaprecaca) /s2pocampto) + bescuents = preciou + asco? pet2( "VALOR VENTA CON DESCUENDO|s/.): " + cantagad * Deseuence) [PECZ("YALOR VENTA CON DESCUENEO(§): "+ [eantaaad * Deacuenta) /tapecanbi0)+ Besa esa pera pEez("aprerta eg un proqucte MO FERECIBLE™) prez("vates ae Facturacien:")? PEEZ("YALOR VENTA (5/.)? + cantadaa*preston) ? PEEZ(YALOR VENTA (3)! " + (cantagaa*precaca) /c2pocampso} + bescuants = preciou * asctoi? EEZ("YALOR VENTA COM DESCUENTO|S/.): * + cantadad * Descuenco) PEEZ("YALOR VENTA COM DESCUENEO(§)! "+ [oantaaad * Descuenta} /tapecanbi0) + BEEZ" esa pera peta("Consetables @2 un producto FERECIBLE consults cecna de caduciaaa")? prez("Datos ae Facturacion:")? PEEZ("YALOR VENTA (5/.)? + cantadaa*preston) ? PEEZ(YALOR VENTA (3)! " + (cantagaa*precaca) /c2pocampso} + Descuents = preciou * asctei? ‘DEEE(*VALOR VENTA GOW DESGUENTO(S/.): = + cantidad * Descuentol? rea(*VALOR VENTA Goll HESCUEIIIO(S)! * + (Gantagad * Deacuento} /srpscambic)# peta(" peta): EES prta("co: vr ceducasea” 3 lene/agoe es sn products FERECIGLE consuive fecha of rea(voacos de Facturacion:"): prta(*VALOR VENTA (5/.): "+ eancidad*prestou) + [pEEg(OVADOR VENTA (5)! * + (cantidadtprectou) /sipocambic)? reg("YALOR VENTA COM DESGUEITO(S/.): * + cantadad * Descuento)# rea(*VALOR VENTA Goll HESCUEIIIO(S)! * + (Gantagad * Deacuento} /srpscambic)# peta(" : sefoul Beta"): prta(vza letra ingresada es sncorzecce"): , static void prt(sczing 2) System. out print (=)? sracic void prta(sering 2) System.cutpeintin(=)?

You might also like