0% found this document useful (0 votes)
5 views9 pages

Programabotonera Parcial2 Arzatemartinez

The document is a programming portfolio by Oscar Giovanny Arzate Martinez, showcasing a project on basic arithmetic operations using Java. It includes an algorithm for summing two numbers, a graphical user interface (GUI) code for a button-based application, and event handling methods for addition, subtraction, and clearing inputs. The project is part of the Fundamentals of Programming course in the Systems Engineering division.

Uploaded by

oscar.arzate201
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views9 pages

Programabotonera Parcial2 Arzatemartinez

The document is a programming portfolio by Oscar Giovanny Arzate Martinez, showcasing a project on basic arithmetic operations using Java. It includes an algorithm for summing two numbers, a graphical user interface (GUI) code for a button-based application, and event handling methods for addition, subtraction, and clearing inputs. The project is part of the Fundamentals of Programming course in the Systems Engineering division.

Uploaded by

oscar.arzate201
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

DIVISIÓN DE INGENIERÍA EN SISTEMAS COMPUTACIONALES

PORTAFOLIO DE EVIDENCIAS

FUNDAMENTOS DE PROGRAMACION
BOTONERA

Nombre del alumno


ARZATE MARTINEZ OSCAR GIOVANNY

Grupo
311-V

2019-1
SISTEMAS OPERATIVOS 2

Algoritmo SUMA

Escribir 'Dame un numero'


Leer a

si a>0 Entonces
Escribir ' Dame un numero'
Leer b
si b>0 Entonces
res <- a+b
Escribir 'La suma es ',res
SiNo
Imprimir "Introdujo valores incorrectos"
FinSi
SiNo
Imprimir "Introdujo valores incorrectos"
FinSi

FinAlgoritmo

DIAGRAMA

ARZATE MARTINEZ OSCAR GIOVANNY


SISTEMAS OPERATIVOS 3

CODIFICACION
*
* To change this license header, choose License Headers in Project
Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author arzate
*/
public class botones extends javax.swing.JFrame {

/**
* Creates new form botones
*/
public botones() {
initComponents();
}

/**
* 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">
private void initComponents() {

jLabel1 = new javax.swing.JLabel();


sumar = new javax.swing.JButton();
restar = new javax.swing.JButton();
limpiar = new javax.swing.JButton();
salir = new javax.swing.JButton();
c1 = new javax.swing.JTextField();
c2 = new javax.swing.JTextField();
res = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();

ARZATE MARTINEZ OSCAR GIOVANNY


SISTEMAS OPERATIVOS 4

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jLabel1.setText("Suma y resta de 2 numeros");

sumar.setText("Sumar");
sumar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
sumarActionPerformed(evt);
}
});

restar.setText("Restar");
restar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
restarActionPerformed(evt);
}
});

limpiar.setText("Limpiar");
limpiar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
limpiarActionPerformed(evt);
}
});

salir.setText("Salir");
salir.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
salirActionPerformed(evt);
}
});

c1.setText(" ");
c1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
c1ActionPerformed(evt);
}
});

c2.setText(" ");

res.setText(" ");

ARZATE MARTINEZ OSCAR GIOVANNY


SISTEMAS OPERATIVOS 5

jLabel2.setText("Valor 1");

jLabel3.setText("Valor 2");

javax.swing.GroupLayout layout = new


javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addComponent(jLabel1)
.addGap(91, 91, 91))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addGap(37, 37, 37)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayo
ut.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(jLabel3))
.addGap(41, 41, 41)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayo
ut.Alignment.LEADING, false)
.addComponent(c2,
javax.swing.GroupLayout.DEFAULT_SIZE, 139, Short.MAX_VALUE)
.addComponent(c1)))
.addGroup(layout.createSequentialGroup()
.addGap(29, 29, 29)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayo
ut.Alignment.LEADING)
.addComponent(res,
javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.Group
Layout.Alignment.TRAILING)
.addComponent(salir)
.addGroup(layout.createSequentialGroup()

ARZATE MARTINEZ OSCAR GIOVANNY


SISTEMAS OPERATIVOS 6

.addComponent(sumar)
.addGap(47, 47, 47)
.addComponent(restar)))
.addGap(18, 18, 18)
.addComponent(limpiar)))))
.addContainerGap(60, Short.MAX_VALUE))
);
layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(20, 20, 20)
.addComponent(jLabel1)
.addGap(32, 32, 32)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.BASELINE)
.addComponent(c1,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.U
NRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.BASELINE)
.addComponent(c2,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3))
.addGap(32, 32, 32)
.addComponent(res)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.R
ELATED, 54, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.BASELINE)
.addComponent(sumar)
.addComponent(restar)
.addComponent(limpiar))
.addGap(20, 20, 20)
.addComponent(salir)
.addContainerGap())
);

ARZATE MARTINEZ OSCAR GIOVANNY


SISTEMAS OPERATIVOS 7

pack();
}// </editor-fold>

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


// TODO add your handling code here:
Double x= Double.parseDouble(c1.getText());
Double y= Double.parseDouble(c2.getText());
Double r=x-y;
res.setText("El resultado de la resta es "+ r);
}

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

// TODO add your handling code here:


System.exit(0);
}

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


// TODO add your handling code here:
Double x= Double.parseDouble(c1.getText());
Double y= Double.parseDouble(c2.getText());
Double r=x+y;
res.setText("El resultado de la suma es "+ r);
}

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


// TODO add your handling code here:
}

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


// TODO add your handling code here:
c1.setText("");
c2.setText("");
res.setText("");
}

/**
* @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) ">

ARZATE MARTINEZ OSCAR GIOVANNY


SISTEMAS OPERATIVOS 8

/* 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(botones.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(botones.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(botones.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(botones.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
}
//</editor-fold>

/* Create and display the form */


java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new botones().setVisible(true);
}
});
}

// Variables declaration - do not modify


private javax.swing.JTextField c1;
private javax.swing.JTextField c2;
private javax.swing.JLabel jLabel1;

ARZATE MARTINEZ OSCAR GIOVANNY


SISTEMAS OPERATIVOS 9

private javax.swing.JLabel jLabel2;


private javax.swing.JLabel jLabel3;
private javax.swing.JButton limpiar;
private javax.swing.JLabel res;
private javax.swing.JButton restar;
private javax.swing.JButton salir;
private javax.swing.JButton sumar;
// End of variables declaration
}

ARZATE MARTINEZ OSCAR GIOVANNY

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy