PROGRAMACALCULADORA-PARCIAL2-ARZATEMARTINEZ
PROGRAMACALCULADORA-PARCIAL2-ARZATEMARTINEZ
PORTAFOLIO DE EVIDENCIAS
FUNDAMENTOS DE PROGRAMACION
CALCULADORA
Grupo
311-V
2019-1
SISTEMAS OPERATIVOS 2
PSEUDOCODIGO
Algoritmo calculadora
Escribir 'Dame un numero'
Leer a
Si a>=1 Entonces
Escribir 'Dame otro valor'
Leer b
SiNo
Escribir 'Introdujo valores incorrectos'
FinSi
Si b>=1 Entonces
suma <- a+b
Escribir 'El resultado de la suma fue ',suma
resta <- a-b
Escribir 'El resultado de la resta fue ',resta
multi <- a*b
Escribir 'El resultado de la multiplicacion fue ',multi
div <- a/b
Escribir 'El resultado de la division fue ',div
SiNo
Escribir 'Introdujo valores incorrectos'
FinSi
FinAlgoritmo
DIAGRAMA
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 form extends javax.swing.JFrame {
/**
* Creates new form form
*/
public form() {
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() {
c1 = new javax.swing.JTextField();
c2 = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
j1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
sumar = new javax.swing.JButton();
restar = new javax.swing.JButton();
dividir = new javax.swing.JButton();
salir = new javax.swing.JButton();
Limpiar = new javax.swing.JButton();
multiplicar = new javax.swing.JButton();
res = new javax.swing.JLabel();
res2 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
c1.setText(" ");
salir.setText("Salir");
salir.addActionListener(new java.awt.event.ActionListener() {
Limpiar.setText("Limpiar");
Limpiar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
LimpiarActionPerformed(evt);
}
});
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(res3))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayo
ut.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(112, 112, 112)
.addComponent(jLabel1))
.addGroup(layout.createSequentialGroup()
.addGap(47, 47, 47)
.addComponent(Limpiar)
.addGap(184, 184, 184)
.addComponent(salir)))
.addGap(0, 26, Short.MAX_VALUE)))
.addGap(32, 32, 32))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayo
ut.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(j1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPla
cement.UNRELATED)
.addComponent(c1))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPla
cement.UNRELATED)
.addComponent(c2,
javax.swing.GroupLayout.PREFERRED_SIZE, 206,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacem
ent.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayo
ut.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addComponent(res)
.addGap(18, 18, 18))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addComponent(res2)
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addGap(24, 24, 24)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.TRAILING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.
Alignment.BASELINE)
.addComponent(c1,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(res))
.addComponent(j1))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(20, 20, 20)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayo
ut.Alignment.BASELINE)
.addComponent(c2,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2)))
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacem
ent.RELATED)
.addComponent(res2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacem
ent.UNRELATED)
.addComponent(res3)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.R
ELATED, 16, Short.MAX_VALUE)
.addComponent(res4)
.addGap(70, 70, 70)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.BASELINE)
.addComponent(sumar)
.addComponent(restar)
.addComponent(multiplicar)
.addComponent(dividir))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.BASELINE)
.addComponent(Limpiar)
.addComponent(salir))
.addGap(26, 26, 26))
);
pack();
}// </editor-fold>
/**
* @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(form.class.getName()).log(java.util.loggin
g.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(form.class.getName()).log(java.util.loggin
g.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(form.class.getName()).log(java.util.loggin
g.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(form.class.getName()).log(java.util.loggin
g.Level.SEVERE, null, ex);
}
//</editor-fold>