43
Tecnológico de Estudios Superiores de Ecatepec División de la Ingeniería en Sistemas Computacionales Materia: Teoría de la computación Profesora: Rosa María Hernández Rojas Integrantes del equipo: Manzano Palacios Iván Gonzales Sánchez Ahydee Esmeralda Proyecto 1er Parcial Autómata de Maquina de Refrescos

Reporte

Embed Size (px)

Citation preview

Page 1: Reporte

Tecnológico de Estudios Superiores de Ecatepec

División de la Ingeniería en Sistemas Computacionales

Materia: Teoría de la computación

Profesora: Rosa María Hernández Rojas

Integrantes del equipo:

Manzano Palacios Iván

Gonzales Sánchez Ahydee Esmeralda

Proyecto 1er Parcial

Autómata de Maquina de Refrescos

Page 2: Reporte

INTRODUCCIÓN

Autómata, del latín automăta y este del griego automatos (αὐτόματος), espontáneo o con movimiento propio. Según la RAE, máquina que imita la figura y los movimientos de un ser animado. Un equivalente tecnológico en la actualidad serían los robots autónomos. Si el robot es antropomorfo se conoce como androide.

El mundo de los autómatas es tan amplio como su definición. En términos bíblicos podríamos considerar al hombre como el primer autómata, creado del barro por Dios, aunque con la diferencia de poseer libre albedrío que le permite decidir por sí mismo. Esa distinción ha hecho que el ser humano haya querido imitar el acto de la creación desde el mismo inicio de su historia, construyendo mecanismos artificiales para todo tipo de fines desde científicos, de investigación, para agilizar sus tareas o por mero entretenimiento.

Los autómatas son mecanismos formales que realizan derivaciones en gramáticas formales. La manera en que las realizan es mediante la nocion del reconocimiento.

Una palabra es generada si y solo si la palabra hace transitar al autómata correspondiente a sus condiciones terminales.

Por esto es que los autómatas son analizadores léxicos de las gramáticas que les corresponden.

Page 3: Reporte

Justificación

La creación de este programa es para demostrar el funcionamiento de un autómata de una maquina de refrescos, mostrando así los conocimientos adquiridos en clase, con la finalidad de mostrar

Objetivo General

El objetivo de este proyecto es la realización un una maquina de refrescos virtual que nos muestre como debe de funcionar un autómata de una máquina expendedora de refrescos.

Objetivo particular

Aprender a programar un autómata y sus diferentes estados para desarrollar una mejor lógica de programación.

Page 4: Reporte

q8

Caminos que el autómata

puede seguir

1

1

1

1

1,

1

1

1

2

2

2

2

2

2

2,

5

5

5

5,

1010

10

10 5, 10

5,10

5, 10

2,5,10

q0

q1 q2

q3 q4

q5 q6

q7

Desarrollo del programa

Page 5: Reporte

0

1. a,a,a,a,a,a,a,a2. a,a,a,a,a,a,a,b3. a,a,a,a,a,a,a,c4. a,a,a,a,a,a,a,d

15. a,a,a,a,a,a,b6. a,a,a,a,a,a,c7. a,a,a,a,a,a,d

28. a,a,a,a,a,c9. a,a,a,a,a,d

310. a,a,a,a,c11. a,a,a,a,d

412. a,a,a,c13. a,a,a,d

514. a,a,d

615. a,d

716. d

817. a,b,a,a,a,a,a18. a,b,a,a,a,a,b19. a,b,a,a,a,a,c20. a,b,a,a,a,a,d

921. a,b,b,a,a,a22. a,b,b,a,a,b23. a,b,b,a,a,c24. a,b,b,a,a,d

1025. a,b,a,b,a,a26. a,b,a,b,a,b27. a,b,a,b,a,c28. a,b,a,b,a,d

1129. a,b,a,a,b,a30. a,b,a,a,b,b31. a,b,a,a,b,c32. a,b,a,a,b,d

1233. a,b,a,a,a,b34. a,b,a,a,a,c35. a,b,a,a,a,d

1336. a,a,b,b,a,a37. a,a,b,b,a,b38. a,a,b,b,a,c39. a,a,b,b,a,d

1440. a,a,b,a,b,a41. a,a,b,a,b,b42. a,a,b,a,b,c43. a,a,b,a,b,d

1544. a,a,b,a,a,b45. a,a,b,a,a,c46. a,a,b,a,a,d

COMBINACIONES TOTALES QUE EL AUTÓMATA PUEDE CONSEGUIR

Page 6: Reporte

1647. a,a,a,b,b,a48. a,a,a,b,b,b49. a,a,a,b,b,c50. a,a,a,b,b,d

1751. a,a,a,b,a,b52. a,a,a,b,a,c53. a,a,a,b,a,d

4254. a,a,a,a,b,b55. a,a,a,a,b,c56. a,a,a,a,b,d

1857. a,b,b,b,a58. a,b,b,b,b59. a,b,b,b,c60. a,b,b,b,d

1961. a,b,a,b,b62. a,b,a,b,c63. a,b,a,b,d

2064. a,b,b,a,b65. a,b,b,a,c66. a,b,b,a,d

2167. a,a,b,b,b68. a,a,b,b,c69. a,a,b,b,d

2270. a,c,a,a71. a,c,a,b72. a,c,a,c73. a,c,a,d

2374. a,a,c,a75. a,a,c,b76. a,a,c,c77. a,a,c,d

2478. a,a,a,c79. a,a,a,d

2580. a,c,b81. a,c,c82. a,c,d

2683. b,a,a,a,a,a,a84. b,a,a,a,a,a,b85. b,a,a,a,a,a,c86. b,a,a,a,a,a,d

2787. b,b,a,a,a,a88. b,b,a,a,a,b89. b,b,a,a,a,c90. b,b,a,a,a,d

2891. b,a,b,a,a,a92. b,a,b,a,a,b93. b,a,b,a,a,c94. b,a,b,a,a,d

Page 7: Reporte

2995. b,a,a,b,a,a96. b,a,a,b,a,b97. b,a,a,b,a,c98. b,a,a,b,a,d

3099. b,a,a,a,b,a100. b,a,a,a,b,b101. b,a,a,a,b,c102. b,a,a,a,b,d

31103. b,a,a,a,a,b104. b,a,a,a,a,c105. b,a,a,a,a,d

32106. b,b,b,a,a107. b,b,b,a,b108. b,b,b,a,c109. b,b,b,a,a

33110. b,a,b,b,a111. b,a,b,b,b112. b,a,b,b,c113. b,a,b,b,d

34114. b,a,a,b,b115. b,a,a,b,c116. b,a,a,b,d

35117. b,b,b,b

36118. b,c,a119. b,c,b120. b,c,c121. b,c,d

37122. b,d

38123. c,a,a,a124. c,a,a,b125. c,a,a,c126. c,a,a,d

39127. c,a,b128. c,a,c129. c,a,d

40130. c,b,a131. c,b,b132. c,b,c

41133. c,c134. c,d

Page 8: Reporte

// Codigo de la Clase que crea el frame de la maquina de refrescos y genera el frame del automata

/* * To change this template, choose Tools | Templates * and open the template in the editor. */

/* * Interfase.java * * Created on 2/10/2010, 12:29:06 PM */

package automata;

import java.awt.Component;import javax.swing.ImageIcon;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPanel;

/** * * @author Ivan */public class Interfase extends javax.swing.JFrame {

int cambio,dinero_maquina, dinero_ingresado, latas_maquina; String cadena; //JPanel dibuja = new JPanel(); JLabel dibuja = new JLabel(); ImageIcon[] latas = {

new ImageIcon(getClass().getResource("/Iconos/lata_coca.jpg")), //new ImageIcon("img\\spriteZero -lata.gif"), new ImageIcon(getClass().getResource("/Iconos/lata_fanta.jpg")), new ImageIcon(getClass().getResource("/Iconos/lata_sprite.jpg")), new ImageIcon(getClass().getResource("/Iconos/lata_sangria.jpg")), new ImageIcon(getClass().getResource("/Iconos/lata_manzana.jpg")), new ImageIcon(getClass().getResource("/Iconos/lata_coca_light.jpg")) }; ImageIcon[] automata = {

new ImageIcon(getClass().getResource("/Iconos/dibuja/0 aaaaaaaa.jpg")),//0 //new ImageIcon("img\\spriteZero -lata.gif"), new ImageIcon(getClass().getResource("/Iconos/dibuja/1 aaaaaab.jpg")),//1

Page 9: Reporte

new ImageIcon(getClass().getResource("/Iconos/dibuja/2 aaaaac.jpg")),//2 new ImageIcon(getClass().getResource("/Iconos/dibuja/3 aaaac.jpg")),//3 new ImageIcon(getClass().getResource("/Iconos/dibuja/4 aaac.jpg")),//4 new ImageIcon(getClass().getResource("/Iconos/dibuja/5 aad.jpg")),//5 new ImageIcon(getClass().getResource("/Iconos/dibuja/6 ad.jpg")),//6 new ImageIcon(getClass().getResource("/Iconos/dibuja/7 d.jpg")),//7 new ImageIcon(getClass().getResource("/Iconos/dibuja/8 abaaaaa.jpg")),//8 new ImageIcon(getClass().getResource("/Iconos/dibuja/9 abbaaa.jpg")),//9 new ImageIcon(getClass().getResource("/Iconos/dibuja/10 ababaa.jpg")),//10 new ImageIcon(getClass().getResource("/Iconos/dibuja/11 abaaba.jpg")),//11 new ImageIcon(getClass().getResource("/Iconos/dibuja/12 abaaab.jpg")),//12 new ImageIcon(getClass().getResource("/Iconos/dibuja/13 aabbaa.jpg")),//13 new ImageIcon(getClass().getResource("/Iconos/dibuja/14 aababa.jpg")),//14 new ImageIcon(getClass().getResource("/Iconos/dibuja/15 aabaab.jpg")),//15 new ImageIcon(getClass().getResource("/Iconos/dibuja/16 aaabba.jpg")),//16 new ImageIcon(getClass().getResource("/Iconos/dibuja/17 aaabab.jpg")),//17 new ImageIcon(getClass().getResource("/Iconos/dibuja/18 abbba.jpg")),//18 new ImageIcon(getClass().getResource("/Iconos/dibuja/19 ababb.jpg")),//19 new ImageIcon(getClass().getResource("/Iconos/dibuja/20 abbab.jpg")),//20 new ImageIcon(getClass().getResource("/Iconos/dibuja/21 aabbb.jpg")),//21 new ImageIcon(getClass().getResource("/Iconos/dibuja/22 acaa.jpg")),//22 new ImageIcon(getClass().getResource("/Iconos/dibuja/23 aaca.jpg")),//23 new ImageIcon(getClass().getResource("/Iconos/dibuja/24 aaac.jpg")),//24 new ImageIcon(getClass().getResource("/Iconos/dibuja/25 acb.jpg")),//25 new ImageIcon(getClass().getResource("/Iconos/dibuja/26 baaaaaa.jpg")),//26 new ImageIcon(getClass().getResource("/Iconos/dibuja/27 bbaaaa.jpg")),//27 new ImageIcon(getClass().getResource("/Iconos/dibuja/28 babaaa.jpg")),//28 new ImageIcon(getClass().getResource("/Iconos/dibuja/29 baabaa.jpg")),//29

Page 10: Reporte

new ImageIcon(getClass().getResource("/Iconos/dibuja/30 baaaba.jpg")),//30 new ImageIcon(getClass().getResource("/Iconos/dibuja/31 baaaab.jpg")),//31 new ImageIcon(getClass().getResource("/Iconos/dibuja/32 bbbaa.jpg")),//32 new ImageIcon(getClass().getResource("/Iconos/dibuja/33 babba.jpg")),//33 new ImageIcon(getClass().getResource("/Iconos/dibuja/34 baabb.jpg")),//34 new ImageIcon(getClass().getResource("/Iconos/dibuja/35 bbbb.jpg")),//35 new ImageIcon(getClass().getResource("/Iconos/dibuja/36 bca.jpg")),//36 new ImageIcon(getClass().getResource("/Iconos/dibuja/37 bd.jpg")),//37 new ImageIcon(getClass().getResource("/Iconos/dibuja/38 caaa.jpg")),//38 new ImageIcon(getClass().getResource("/Iconos/dibuja/39 cab.jpg")),//39 new ImageIcon(getClass().getResource("/Iconos/dibuja/40 cba.jpg")),//40 new ImageIcon(getClass().getResource("/Iconos/dibuja/41 cc.jpg")),//41 new ImageIcon(getClass().getResource("/Iconos/dibuja/42 aaaabb.jpg")),//42 };

/** Creates new form Interfase */ public Interfase() { initComponents();

dinero_maquina=300; latas_maquina=100; cadena="";

btn_toma_y_recoge.setEnabled(false); btn_coca.setVisible(false); btn_fanta.setVisible(false); btn_sprite.setVisible(false); btn_sangria.setVisible(false); btn_manzana.setVisible(false); btn_coca_light.setVisible(false); btn_seguir.setVisible(false); btn_dibuja_automata.setVisible(false); pnl_recoge.setVisible(false);

lbl_cambio.setText("$"); lbl_ingresado.setText("$"); lbl_dinero_maquina.setText("$"+dinero_maquina); lbl_latas.setText(""+latas_maquina);

Page 11: Reporte

}

/** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() {

btn_1_peso = new javax.swing.JButton(); btn_2_pesos = new javax.swing.JButton(); btn_5_pesos = new javax.swing.JButton(); btn_10_pesos = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); lbl_dinero_maquina = new javax.swing.JLabel(); lbl_latas = new javax.swing.JLabel(); lbl_ingresado = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); btn_toma_y_recoge = new javax.swing.JButton(); btn_coca = new javax.swing.JButton(); btn_fanta = new javax.swing.JButton(); btn_sprite = new javax.swing.JButton(); btn_sangria = new javax.swing.JButton(); jLabel4 = new javax.swing.JLabel(); lbl_cambio = new javax.swing.JLabel(); btn_seguir = new javax.swing.JButton(); btn_manzana = new javax.swing.JButton(); btn_coca_light = new javax.swing.JButton(); pnl_recoge = new javax.swing.JPanel(); lbl_recoge = new javax.swing.JLabel(); btn_dibuja_automata = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setBounds(new java.awt.Rectangle(0, 0, 0, 0));

btn_1_peso.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/un_patipeso.png"))); // NOI18N btn_1_peso.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_1_pesoActionPerformed(evt); } });

btn_2_pesos.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/dos_patipesos.png"))); // NOI18N btn_2_pesos.addActionListener(new java.awt.event.ActionListener() {

Page 12: Reporte

public void actionPerformed(java.awt.event.ActionEvent evt) { btn_2_pesosActionPerformed(evt); } });

btn_5_pesos.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/cinco_patipesos.png"))); // NOI18N btn_5_pesos.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_5_pesosActionPerformed(evt); } });

btn_10_pesos.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/diez_patipesos.png"))); // NOI18N btn_10_pesos.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_10_pesosActionPerformed(evt); } });

jLabel1.setText("Ingresa Dinero");

lbl_dinero_maquina.setText(".");

lbl_latas.setText(".");

lbl_ingresado.setText(".");

jLabel2.setText("Dinero inside");

jLabel3.setText("Latas");

jLabel5.setText("Dinero insertado");

btn_toma_y_recoge.setText("Tomar cambio y elegir Refresco"); btn_toma_y_recoge.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_toma_y_recogeActionPerformed(evt); } });

btn_coca.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/logo_coca.jpg"))); // NOI18N btn_coca.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_cocaActionPerformed(evt); } });

Page 13: Reporte

btn_fanta.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/logo_fanta.jpg"))); // NOI18N btn_fanta.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_fantaActionPerformed(evt); } });

btn_sprite.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/logo_sprite.jpg"))); // NOI18N btn_sprite.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_spriteActionPerformed(evt); } });

btn_sangria.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/logo_sangria.jpg"))); // NOI18N btn_sangria.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_sangriaActionPerformed(evt); } });

jLabel4.setText("Su cambio:");

lbl_cambio.setText(".");

btn_seguir.setText("Seguir comprando"); btn_seguir.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_seguirActionPerformed(evt); } });

btn_manzana.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/logo_manzana.jpg"))); // NOI18N btn_manzana.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_manzanaActionPerformed(evt); } });

btn_coca_light.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/logo_coca_ligth.jpg"))); // NOI18N btn_coca_light.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) {

Page 14: Reporte

btn_coca_lightActionPerformed(evt); } });

pnl_recoge.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

javax.swing.GroupLayout pnl_recogeLayout = new javax.swing.GroupLayout(pnl_recoge); pnl_recoge.setLayout(pnl_recogeLayout); pnl_recogeLayout.setHorizontalGroup( pnl_recogeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnl_recogeLayout.createSequentialGroup() .addContainerGap() .addComponent(lbl_recoge, javax.swing.GroupLayout.DEFAULT_SIZE, 152, Short.MAX_VALUE) .addContainerGap()) ); pnl_recogeLayout.setVerticalGroup( pnl_recogeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lbl_recoge, javax.swing.GroupLayout.DEFAULT_SIZE, 257, Short.MAX_VALUE) );

btn_dibuja_automata.setText("Dibujar automata"); btn_dibuja_automata.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_dibuja_automataActionPerformed(evt); } });

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(btn_coca_light, javax.swing.GroupLayout.Alignment.LEADING, 0, 0, Short.MAX_VALUE) .addComponent(btn_manzana, javax.swing.GroupLayout.Alignment.LEADING, 0, 0, Short.MAX_VALUE) .addComponent(btn_sangria, javax.swing.GroupLayout.Alignment.LEADING, 0, 0, Short.MAX_VALUE) .addComponent(btn_sprite, javax.swing.GroupLayout.Alignment.LEADING, 0, 0, Short.MAX_VALUE)

Page 15: Reporte

.addComponent(btn_fanta, javax.swing.GroupLayout.Alignment.LEADING, 0, 0, Short.MAX_VALUE) .addComponent(btn_coca, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 116, Short.MAX_VALUE)) .addComponent(pnl_recoge, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addComponent(btn_seguir) .addGap(18, 18, 18) .addComponent(btn_dibuja_automata))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(btn_5_pesos, javax.swing.GroupLayout.Alignment.LEADING, 0, 0, Short.MAX_VALUE) .addComponent(btn_1_peso, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 153, Short.MAX_VALUE) .addComponent(jLabel1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btn_2_pesos, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btn_10_pesos, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(142, 142, 142)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addGap(18, 18, 18) .addComponent(jLabel2)) .addComponent(jLabel3) .addComponent(jLabel5)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

Page 16: Reporte

.addComponent(lbl_dinero_maquina, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lbl_latas, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lbl_ingresado, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(105, 105, 105) .addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lbl_cambio, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(46, 46, 46))) .addContainerGap()) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(btn_toma_y_recoge) .addGap(71, 71, 71)))) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btn_coca, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btn_fanta, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(btn_sprite, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(btn_sangria, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGap(36, 36, 36)

Page 17: Reporte

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(btn_2_pesos, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btn_1_peso, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addComponent(btn_manzana) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btn_coca_light, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(pnl_recoge, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btn_seguir) .addComponent(btn_dibuja_automata))) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btn_10_pesos) .addComponent(btn_5_pesos)) .addGap(55, 55, 55) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lbl_dinero_maquina) .addComponent(jLabel2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lbl_latas) .addComponent(jLabel3)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lbl_ingresado) .addComponent(jLabel5)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lbl_cambio) .addComponent(jLabel4))

Page 18: Reporte

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btn_toma_y_recoge) .addGap(334, 334, 334)))) );

pack(); }// </editor-fold>//GEN-END:initComponents

private void btn_toma_y_recogeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_toma_y_recogeActionPerformed

cambio=dinero_ingresado-8; lbl_cambio.setText("$" +cambio); latas_maquina=latas_maquina-1;

dinero_maquina=dinero_maquina-cambio; lbl_dinero_maquina.setText("S"+dinero_maquina);

btn_coca.setVisible(true); btn_fanta.setVisible(true); btn_sprite.setVisible(true); btn_sangria.setVisible(true); btn_coca_light.setVisible(true); btn_manzana.setVisible(true); btn_toma_y_recoge.setEnabled(false);

pnl_recoge.setVisible(true); lbl_latas.setText(""+ latas_maquina);

// TODO add your handling code here: }//GEN-LAST:event_btn_toma_y_recogeActionPerformed

private void btn_1_pesoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_1_pesoActionPerformed

dinero_ingresado+=+1;

dinero_maquina+=+1; cadena+="a";

if(dinero_ingresado>=8) { btn_1_peso.setEnabled(false); btn_2_pesos.setEnabled(false); btn_5_pesos.setEnabled(false); btn_10_pesos.setEnabled(false); btn_toma_y_recoge.setEnabled(true); }

Page 19: Reporte

lbl_ingresado.setText("$"+ dinero_ingresado); lbl_dinero_maquina.setText("$"+dinero_maquina); // TODO add your handling code here: }//GEN-LAST:event_btn_1_pesoActionPerformed

private void btn_2_pesosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_2_pesosActionPerformed

dinero_ingresado+=+2;

dinero_maquina+=+2; cadena+="b";

if(dinero_ingresado>=8) { btn_1_peso.setEnabled(false); btn_2_pesos.setEnabled(false); btn_5_pesos.setEnabled(false); btn_10_pesos.setEnabled(false); btn_toma_y_recoge.setEnabled(true); }

lbl_ingresado.setText("$"+ dinero_ingresado); lbl_dinero_maquina.setText("$"+dinero_maquina);

// TODO add your handling code here: }//GEN-LAST:event_btn_2_pesosActionPerformed

private void btn_5_pesosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_5_pesosActionPerformed

dinero_ingresado+=+5;

dinero_maquina+=+5;

cadena+="c"; //lbl_cadena.setText(cadena);

if(dinero_ingresado>=8) { btn_1_peso.setEnabled(false); btn_2_pesos.setEnabled(false); btn_5_pesos.setEnabled(false); btn_10_pesos.setEnabled(false); btn_toma_y_recoge.setEnabled(true); }

lbl_ingresado.setText("$"+ dinero_ingresado); lbl_dinero_maquina.setText("$"+dinero_maquina); // TODO add your handling code here:

}//GEN-LAST:event_btn_5_pesosActionPerformed

private void btn_10_pesosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_10_pesosActionPerformed

Page 20: Reporte

dinero_ingresado+=+10;

dinero_maquina+=+10; cadena+="d";

if(dinero_ingresado>=8) { btn_1_peso.setEnabled(false); btn_2_pesos.setEnabled(false); btn_5_pesos.setEnabled(false); btn_10_pesos.setEnabled(false); btn_toma_y_recoge.setEnabled(true); }

lbl_ingresado.setText("$"+ dinero_ingresado); lbl_dinero_maquina.setText("$"+dinero_maquina);

// TODO add your handling code here: }//GEN-LAST:event_btn_10_pesosActionPerformed

private void btn_seguirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_seguirActionPerformed

btn_1_peso.setEnabled(true); btn_2_pesos.setEnabled(true); btn_5_pesos.setEnabled(true); btn_10_pesos.setEnabled(true); btn_toma_y_recoge.setEnabled(false); btn_coca.setVisible(false); btn_fanta.setVisible(false); btn_sprite.setVisible(false); btn_sangria.setVisible(false); btn_coca_light.setVisible(false); btn_manzana.setVisible(false); btn_seguir.setVisible(false); btn_dibuja_automata.setVisible(false); pnl_recoge.setVisible(false);

dinero_ingresado=0; lbl_ingresado.setText("$"); lbl_cambio.setText("$"); lbl_recoge.setIcon(null); cadena="";

// TODO add your handling code here: }//GEN-LAST:event_btn_seguirActionPerformed

private void btn_cocaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_cocaActionPerformed

lbl_recoge.setIcon(latas[0]); btn_seguir.setVisible(true);

btn_coca.setVisible(false);

Page 21: Reporte

btn_coca_light.setVisible(false); btn_fanta.setVisible(false); btn_manzana.setVisible(false); btn_sangria.setVisible(false); btn_sprite.setVisible(false); btn_dibuja_automata.setVisible(true); // TODO add your handling code here: }//GEN-LAST:event_btn_cocaActionPerformed

private void btn_fantaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_fantaActionPerformed

lbl_recoge.setIcon(latas[1]); btn_seguir.setVisible(true);

btn_coca.setVisible(false); btn_coca_light.setVisible(false); btn_fanta.setVisible(false); btn_manzana.setVisible(false); btn_sangria.setVisible(false); btn_sprite.setVisible(false); btn_dibuja_automata.setVisible(true); // TODO add your handling code here: }//GEN-LAST:event_btn_fantaActionPerformed

private void btn_spriteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_spriteActionPerformed

lbl_recoge.setIcon(latas[2]); btn_seguir.setVisible(true);

btn_coca.setVisible(false); btn_coca_light.setVisible(false); btn_fanta.setVisible(false); btn_manzana.setVisible(false); btn_sangria.setVisible(false); btn_sprite.setVisible(false); btn_dibuja_automata.setVisible(true);

// TODO add your handling code here: }//GEN-LAST:event_btn_spriteActionPerformed

private void btn_sangriaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_sangriaActionPerformed

lbl_recoge.setIcon(latas[3]); btn_seguir.setVisible(true);

btn_coca.setVisible(false); btn_coca_light.setVisible(false); btn_fanta.setVisible(false); btn_manzana.setVisible(false); btn_sangria.setVisible(false); btn_sprite.setVisible(false); btn_dibuja_automata.setVisible(true); // TODO add your handling code here: }//GEN-LAST:event_btn_sangriaActionPerformed

Page 22: Reporte

private void btn_manzanaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_manzanaActionPerformed

lbl_recoge.setIcon(latas[4]); btn_seguir.setVisible(true);

btn_coca.setVisible(false); btn_coca_light.setVisible(false); btn_fanta.setVisible(false); btn_manzana.setVisible(false); btn_sangria.setVisible(false); btn_sprite.setVisible(false); btn_dibuja_automata.setVisible(true);

// TODO add your handling code here: }//GEN-LAST:event_btn_manzanaActionPerformed

private void btn_coca_lightActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_coca_lightActionPerformed

lbl_recoge.setIcon(latas[5]); btn_seguir.setVisible(true);

btn_coca.setVisible(false); btn_coca_light.setVisible(false); btn_fanta.setVisible(false); btn_manzana.setVisible(false); btn_sangria.setVisible(false); btn_sprite.setVisible(false); btn_dibuja_automata.setVisible(true);

// TODO add your handling code here: }//GEN-LAST:event_btn_coca_lightActionPerformed

private void btn_dibuja_automataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_dibuja_automataActionPerformed

btn_dibuja_automata.setVisible(false);

if(cadena.equals("aaaaaaaa")||cadena.equals("aaaaaaab")||cadena.equals("aaaaaaac")||cadena.equals("aaaaaaad")) { dibuja.setIcon(automata[0]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("aaaaaab")||cadena.equals("aaaaaac")||cadena.equals("aaaaaad")) { dibuja.setIcon(automata[1]); JFrame frame=new JFrame();

Page 23: Reporte

frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("aaaaac")||cadena.equals("aaaaad")) { dibuja.setIcon(automata[2]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("aaaac")||cadena.equals("aaaad")) { dibuja.setIcon(automata[3]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("aaac")||cadena.equals("aaad")) { dibuja.setIcon(automata[4]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("aad")) { dibuja.setIcon(automata[5]); JFrame frame=new JFrame(); frame.setSize(500, 500); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("ad")) { dibuja.setIcon(automata[6]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("d")) { dibuja.setIcon(automata[7]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja);

Page 24: Reporte

}

if(cadena.equals("abaaaaa")||cadena.equals("abaaaab")||cadena.equals("abaaaac")||cadena.equals("abaaaad")) { dibuja.setIcon(automata[8]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("abbaaa")||cadena.equals("abbaab")||cadena.equals("abbaac")||cadena.equals("abbaad")) { dibuja.setIcon(automata[9]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("ababaa")||cadena.equals("ababab")||cadena.equals("ababac")||cadena.equals("ababad")) { dibuja.setIcon(automata[10]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("abaaba")||cadena.equals("abaabb")||cadena.equals("abaabc")||cadena.equals("abaabd")) { dibuja.setIcon(automata[11]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("abaaab")||cadena.equals("abaaac")||cadena.equals("abaaad")) { dibuja.setIcon(automata[12]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("aabbaa")||cadena.equals("aabbab")||cadena.equals("aabbac")||cadena.equals("aabbad")) { dibuja.setIcon(automata[13]); JFrame frame=new JFrame();

Page 25: Reporte

frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("aababa")||cadena.equals("aababb")||cadena.equals("aababc")||cadena.equals("aababd")) { dibuja.setIcon(automata[14]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); } if(cadena.equals("aabaab")||cadena.equals("aabaac")||cadena.equals("aabaad")) { dibuja.setIcon(automata[15]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("aaabba")||cadena.equals("aaabbb")||cadena.equals("aaabbc")||cadena.equals("aaabbd")) { dibuja.setIcon(automata[16]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("aaabab")||cadena.equals("aaabac")||cadena.equals("aaabad")) { dibuja.setIcon(automata[17]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("abbba")||cadena.equals("abbbb")||cadena.equals("abbbc")||cadena.equals("abbbd")) { dibuja.setIcon(automata[18]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("ababb")||cadena.equals("ababc")||cadena.equals("ababd"))

Page 26: Reporte

{ dibuja.setIcon(automata[19]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("abbab")||cadena.equals("abbac")||cadena.equals("abbad")) { dibuja.setIcon(automata[20]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("aabbb")||cadena.equals("aabbc")||cadena.equals("aabbd")) { dibuja.setIcon(automata[21]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("acaa")||cadena.equals("acab")||cadena.equals("acac")||cadena.equals("acad")) { dibuja.setIcon(automata[22]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("aaca")||cadena.equals("aacb")||cadena.equals("aacc")||cadena.equals("aacd")) { dibuja.setIcon(automata[23]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("aaac")||cadena.equals("aaad")) { dibuja.setIcon(automata[24]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

Page 27: Reporte

if(cadena.equals("acb")||cadena.equals("acc")||cadena.equals("acd")) { dibuja.setIcon(automata[25]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("baaaaaa")||cadena.equals("baaaaab")||cadena.equals("baaaaac")||cadena.equals("baaaaad")) { dibuja.setIcon(automata[26]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("bbaaaa")||cadena.equals("bbaaab")||cadena.equals("bbaaac")||cadena.equals("bbaaad")) { dibuja.setIcon(automata[27]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("babaaa")||cadena.equals("babaab")||cadena.equals("babaac")||cadena.equals("babaad")) { dibuja.setIcon(automata[28]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("baabaa")||cadena.equals("baabab")||cadena.equals("baabac")||cadena.equals("baabad")) { dibuja.setIcon(automata[29]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("baaaba")||cadena.equals("baaabb")||cadena.equals("baaabc")||cadena.equals("baaabd")) { dibuja.setIcon(automata[30]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true);

Page 28: Reporte

Component add = frame.add(dibuja); }

if(cadena.equals("baaaab")||cadena.equals("baaaac")||cadena.equals("baaaad")) { dibuja.setIcon(automata[31]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("bbbaa")||cadena.equals("bbbab")||cadena.equals("bbbac")||cadena.equals("bbbad")) { dibuja.setIcon(automata[32]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("babba")||cadena.equals("babbb")||cadena.equals("babbc")||cadena.equals("babbd")) { dibuja.setIcon(automata[33]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("baabb")||cadena.equals("baabc")||cadena.equals("baabd")) { dibuja.setIcon(automata[34]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("bbbb")) { dibuja.setIcon(automata[35]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("bca")||cadena.equals("bcb")||cadena.equals("bcc")||cadena.equals("bcd")) { dibuja.setIcon(automata[36]); JFrame frame=new JFrame();

Page 29: Reporte

frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("bd")) { dibuja.setIcon(automata[37]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("caaa")||cadena.equals("caab")||cadena.equals("caac")||cadena.equals("caad")) { dibuja.setIcon(automata[38]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("cab")||cadena.equals("cac")||cadena.equals("cad")) { dibuja.setIcon(automata[39]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("cba")||cadena.equals("cbb")||cadena.equals("cbc")) { dibuja.setIcon(automata[40]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("cc")||cadena.equals("cd")) { dibuja.setIcon(automata[41]); JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

if(cadena.equals("aaaabb")||cadena.equals("aaaabc")||cadena.equals("aaaabd")) { dibuja.setIcon(automata[42]);

Page 30: Reporte

JFrame frame=new JFrame(); frame.setSize(500, 700); frame.setVisible(true); Component add = frame.add(dibuja); }

// TODO add your handling code here: }//GEN-LAST:event_btn_dibuja_automataActionPerformed

/** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Interfase().setVisible(true); } }); }

// Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btn_10_pesos; private javax.swing.JButton btn_1_peso; private javax.swing.JButton btn_2_pesos; private javax.swing.JButton btn_5_pesos; private javax.swing.JButton btn_coca; private javax.swing.JButton btn_coca_light; private javax.swing.JButton btn_dibuja_automata; private javax.swing.JButton btn_fanta; private javax.swing.JButton btn_manzana; private javax.swing.JButton btn_sangria; private javax.swing.JButton btn_seguir; private javax.swing.JButton btn_sprite; private javax.swing.JButton btn_toma_y_recoge; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel lbl_cambio; private javax.swing.JLabel lbl_dinero_maquina; private javax.swing.JLabel lbl_ingresado; private javax.swing.JLabel lbl_latas; private javax.swing.JLabel lbl_recoge; private javax.swing.JPanel pnl_recoge; // End of variables declaration//GEN-END:variables

}

Page 31: Reporte

Al iniciar el programa esta será la primera pantalla que se nos mostrar, aquí es donde ingresaremos el dinero para poder comprar una lata de refresco

Los datos de entrada son:

El costo de la lata será de 8 pesos. El dinero total que la maquina tiene para dar cambio será de $300 pesos La maquina tendrá en su inventario un numero de 100 latas en total para venta

Page 32: Reporte

Una vez insertados los 8 pesos o una mayor cantidad a ese numero se habilitara el boton para poder Tomar cambio y elegir refresco y aparecerán los botones para elegir el refresco que hemos comprado, dándonos cambio si es que hemos insertado una cantidad mayor al costo del refresco

Page 33: Reporte

Una vez que el refresco ha sido elegido nos encontraremos con dos opciones las cuales son seguir comprando o dibujar el autómata.

Si elegimos seguir comprando de nuevo se habilitaran los botones para ingresar dinero y se repetirá de nuevo todo el proceso.

Page 34: Reporte

Pero si elegimos dibujar el autómata nos abrirá una nueva pantalla la cual nos indicara el camino que el autómata siguió en la inserción del dinero

Page 35: Reporte