Informe técnico de tópicos avanzados de programación

22
Instituto Tecnológico Superior De Felipe Carrillo Puerto Tópicos avanzados de programación Unidad 1 INFORME TÉCNICO MTI. Niels Henryk Aranda Cueva Alumno: HUGO ARMANDO CHUC OY

description

 

Transcript of Informe técnico de tópicos avanzados de programación

Page 1: Informe técnico de tópicos avanzados de programación

Instituto Tecnológico Superior

De

Felipe Carrillo Puerto

Tópicos avanzados de programación

Unidad 1

INFORME TÉCNICO

MTI. Niels Henryk Aranda Cueva

Alumno: HUGO ARMANDO CHUC OY

4-A J-3 ISCFelipe Carrillo Puerto a 05/03/2014

Page 2: Informe técnico de tópicos avanzados de programación

INFORME TECNICO

CALCULADORA

import javax.swing.JTextField;

public class CAL extends javax.swing.JFrame {

public CAL() {

initComponents();

}

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

jTextField1 = new javax.swing.JTextField();

jTextField2 = new javax.swing.JTextField();

jTextField3 = new javax.swing.JTextField();

jButton1 = new javax.swing.JButton();

jButton2 = new javax.swing.JButton();

jButton5 = new javax.swing.JButton();

jButton6 = new javax.swing.JButton();

jButton7 = new javax.swing.JButton();

jButton8 = new javax.swing.JButton();

jButton3 = new javax.swing.JButton();

jButton4 = new javax.swing.JButton();

jButton9 = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jTextField1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jTextField1.addActionListener(new java.awt.event.ActionListener() {

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

Page 3: Informe técnico de tópicos avanzados de programación

jTextField1ActionPerformed(evt);

}

});

jTextField2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jTextField3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jTextField3.addActionListener(new java.awt.event.ActionListener() {

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

jTextField3ActionPerformed(evt);

}

});

jButton1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton1.setText("+");

jButton1.addActionListener(new java.awt.event.ActionListener() {

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

jButton1ActionPerformed(evt);

}

});

jButton2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton2.setText("-");

jButton2.addActionListener(new java.awt.event.ActionListener() {

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

jButton2ActionPerformed(evt);

}

});

Page 4: Informe técnico de tópicos avanzados de programación

jButton5.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton5.setText("*");

jButton5.addActionListener(new java.awt.event.ActionListener() {

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

jButton5ActionPerformed(evt);

}

});

jButton6.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton6.setText("/");

jButton6.addActionListener(new java.awt.event.ActionListener() {

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

jButton6ActionPerformed(evt);

}

});

jButton7.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton7.setText("%");

jButton7.addActionListener(new java.awt.event.ActionListener() {

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

jButton7ActionPerformed(evt);

}

});

jButton8.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton8.setText("RAIZ");

jButton8.addActionListener(new java.awt.event.ActionListener() {

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

jButton8ActionPerformed(evt);

Page 5: Informe técnico de tópicos avanzados de programación

}

});

jButton3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton3.setText("^2");

jButton3.addActionListener(new java.awt.event.ActionListener() {

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

jButton3ActionPerformed(evt);

}

});

jButton4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton4.setText("^3");

jButton4.addActionListener(new java.awt.event.ActionListener() {

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

jButton4ActionPerformed(evt);

}

});

jButton9.setText("c");

jButton9.addActionListener(new java.awt.event.ActionListener() {

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

jButton9ActionPerformed(evt);

}

});

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

Page 6: Informe técnico de tópicos avanzados de programación

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGap(56, 56, 56)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)

.addComponent(jButton7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(jButton4, javax.swing.GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE))

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addGroup(layout.createSequentialGroup()

.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(layout.createSequentialGroup()

.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE))))

.addGroup(layout.createSequentialGroup()

.addComponent(jButton9)

.addGap(76, 76, 76)))

Page 7: Informe técnico de tópicos avanzados de programación

.addGap(18, 18, 18)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

.addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE)

.addComponent(jButton5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

.addComponent(jTextField3, javax.swing.GroupLayout.Alignment.TRAILING)

.addGroup(layout.createSequentialGroup()

.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))))

.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

);

layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGap(21, 21, 21)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGap(20, 20, 20)

.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)

Page 8: Informe técnico de tópicos avanzados de programación

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(jButton9)

.addGap(31, 31, 31)))

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jButton4)

.addComponent(jButton6)

.addComponent(jButton1))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jButton7)

.addComponent(jButton2)

.addComponent(jButton8)

.addComponent(jButton5))

.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

);

pack();

}// </editor-fold>

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

double n1,n2,r;

n1=Double.parseDouble(jTextField1.getText());

n2=Double.parseDouble(jTextField2.getText());

r=n1-n2;

Page 9: Informe técnico de tópicos avanzados de programación

jTextField3.setText(String.valueOf(r));

}

private void jTextField3ActionPerformed(java.awt.event.ActionEvent evt) {

double n1,n2,r;

n1=Double.parseDouble(jTextField1.getText());

n2=Double.parseDouble(jTextField2.getText());

r=n1-n2;

jTextField3.setText(String.valueOf(r));

}

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

double n,m,r1;

n=Double.parseDouble(jTextField1.getText());

m=Double.parseDouble(jTextField2.getText());

r1=n+m;

jTextField3.setText(String.valueOf(r1));

}

private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {

double a,b,r2;

a=Double.parseDouble(jTextField1.getText());

b=Double.parseDouble(jTextField2.getText());

r2=a/b;

jTextField3.setText(String.valueOf(r2));

Page 10: Informe técnico de tópicos avanzados de programación

}

private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {

double c,d,r3;

c=Double.parseDouble(jTextField1.getText());

d=Double.parseDouble(jTextField2.getText());

r3=((c*d)/100);

jTextField3.setText(String.valueOf(r3));

}

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {

double x,y,r4;

x=Double.parseDouble(jTextField1.getText());

y=Double.parseDouble(jTextField2.getText());

r4=(x*y);

jTextField3.setText(String.valueOf(r4));

}

private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {

double c1,d1,r5;

c1=Double.parseDouble(jTextField1.getText());

r5=(c1*(1/4));

Page 11: Informe técnico de tópicos avanzados de programación

jTextField3.setText(String.valueOf(r5));

}

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {

double c3,r6;

c3=Double.parseDouble(jTextField1.getText());

r6=c3*c3;

jTextField3.setText(String.valueOf(r6));

}

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {

double c8,r8;

c8=Double.parseDouble(jTextField1.getText());

r8=c8*c8*c8;

jTextField3.setText(String.valueOf(r8));

}

private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

}

private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {

Page 12: Informe técnico de tópicos avanzados de programación

jTextField1.setText(String.valueOf(""));

jTextField2.setText(String.valueOf(""));

jTextField3.setText(String.valueOf(""));

}

public static void main(String args[]) {

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new CAL().setVisible(true);

}

});

}

// Variables declaration - do not modify

private javax.swing.JButton jButton1;

private javax.swing.JButton jButton2;

private javax.swing.JButton jButton3;

private javax.swing.JButton jButton4;

private javax.swing.JButton jButton5;

private javax.swing.JButton jButton6;

private javax.swing.JButton jButton7;

private javax.swing.JButton jButton8;

private javax.swing.JButton jButton9;

private javax.swing.JTextField jTextField1;

private javax.swing.JTextField jTextField2;

private javax.swing.JTextField jTextField3;

// End of variables declaration

Page 13: Informe técnico de tópicos avanzados de programación

private void delete(JTextField jTextField1) {

throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.

}

}

SALUDO

public class saludos extends javax.swing.JFrame {

/**

* Creates new form saludos

*/

public saludos() {

initComponents();

}

/**

* This method is called from within the constructor to initialize the form.

Page 14: Informe técnico de tópicos avanzados de programación

* 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">

private void initComponents() {

jButton1 = new javax.swing.JButton();

jButton2 = new javax.swing.JButton();

jTextField1 = new javax.swing.JTextField();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jButton1.setText("1");

jButton1.addActionListener(new java.awt.event.ActionListener() {

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

jButton1ActionPerformed(evt);

}

});

jButton2.setText("2");

jButton2.addActionListener(new java.awt.event.ActionListener() {

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

jButton2ActionPerformed(evt);

}

});

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

Page 15: Informe técnico de tópicos avanzados de programación

layout.setHorizontalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()

.addContainerGap()

.addComponent(jButton1)

.addGap(32, 32, 32)

.addComponent(jButton2)

.addGap(18, 18, 18)

.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)

.addContainerGap(171, Short.MAX_VALUE))

);

layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGap(51, 51, 51)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jButton1)

.addComponent(jButton2)

.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

.addContainerGap(226, Short.MAX_VALUE))

);

pack();

}// </editor-fold>

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

jTextField1.setText("adios");

Page 16: Informe técnico de tópicos avanzados de programación

}

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

jTextField1.setText("hola");

}

/**

* @param args the command line arguments

*/

public static void main(String args[]) {

/* Set the Nimbus look and feel */

//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">

/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.

* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

*/

try {

for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName())) {

javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

}

}

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(saludos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (InstantiationException ex) {

Page 17: Informe técnico de tópicos avanzados de programación

java.util.logging.Logger.getLogger(saludos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(saludos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(saludos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

}

//</editor-fold>

/* Create and display the form */

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new saludos().setVisible(true);

}

});

}

// Variables declaration - do not modify

private javax.swing.JButton jButton1;

private javax.swing.JButton jButton2;

private javax.swing.JTextField jTextField1;

// End of variables declaration

}

Page 18: Informe técnico de tópicos avanzados de programación