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

PROGRAMACALCULADORA-PARCIAL2-ARZATEMARTINEZ

The document presents a programming portfolio for a calculator application created by Oscar Giovanny Arzate Martinez as part of a systems engineering course. It includes pseudocode for basic arithmetic operations and Java code for a graphical user interface that allows users to perform addition, subtraction, multiplication, and division. The application also features input validation and options to clear inputs or exit the program.

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 views12 pages

PROGRAMACALCULADORA-PARCIAL2-ARZATEMARTINEZ

The document presents a programming portfolio for a calculator application created by Oscar Giovanny Arzate Martinez as part of a systems engineering course. It includes pseudocode for basic arithmetic operations and Java code for a graphical user interface that allows users to perform addition, subtraction, multiplication, and division. The application also features input validation and options to clear inputs or exit the program.

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/ 12

DIVISIÓN DE INGENIERÍA EN SISTEMAS COMPUTACIONALES

PORTAFOLIO DE EVIDENCIAS

FUNDAMENTOS DE PROGRAMACION
CALCULADORA

Nombre del alumno


ARZATE MARTINEZ OSCAR GIOVANNY

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

ARZATE MARTINEZ OSCAR GIOVANNY


SISTEMAS OPERATIVOS 3

ARZATE MARTINEZ OSCAR GIOVANNY


SISTEMAS OPERATIVOS 4

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();

ARZATE MARTINEZ OSCAR GIOVANNY


SISTEMAS OPERATIVOS 5

res3 = new javax.swing.JLabel();


res4 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

c1.setText(" ");

jLabel1.setFont(new java.awt.Font("UnDinaru", 1, 36)); // NOI18N


jLabel1.setForeground(new java.awt.Color(51, 0, 102));
jLabel1.setText("OPERACIONES BASICAS");

j1.setForeground(new java.awt.Color(51, 0, 102));


j1.setText("VALOR 1");

jLabel2.setForeground(new java.awt.Color(51, 0, 102));


jLabel2.setText("VALOR 2");

sumar.setForeground(new java.awt.Color(0, 204, 0));


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

restar.setForeground(new java.awt.Color(0, 0, 255));


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

dividir.setForeground(new java.awt.Color(51, 51, 0));


dividir.setText("Dividir");
dividir.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
dividirActionPerformed(evt);
}
});

salir.setText("Salir");
salir.addActionListener(new java.awt.event.ActionListener() {

ARZATE MARTINEZ OSCAR GIOVANNY


SISTEMAS OPERATIVOS 6

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


salirActionPerformed(evt);
}
});

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

multiplicar.setForeground(new java.awt.Color(255, 0, 0));


multiplicar.setText("Multiplicar");
multiplicar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
multiplicarActionPerformed(evt);
}
});

res.setForeground(new java.awt.Color(0, 204, 0));

res2.setForeground(new java.awt.Color(0, 0, 255));


res2.setText(" ");

res3.setForeground(new java.awt.Color(255, 0, 0));


res3.setText(" ");

res4.setForeground(new java.awt.Color(51, 51, 0));


res4.setText(" ");

javax.swing.GroupLayout layout = new


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

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))

ARZATE MARTINEZ OSCAR GIOVANNY


SISTEMAS OPERATIVOS 7

.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)

ARZATE MARTINEZ OSCAR GIOVANNY


SISTEMAS OPERATIVOS 8

.addGap(28, 28, 28))))


.addGroup(layout.createSequentialGroup()
.addComponent(sumar)
.addGap(47, 47, 47)
.addComponent(restar)
.addGap(31, 31, 31)
.addComponent(multiplicar)
.addGap(33, 33, 33)
.addComponent(dividir)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(res4,
javax.swing.GroupLayout.PREFERRED_SIZE, 177,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18))))
);
layout.setVerticalGroup(

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,

ARZATE MARTINEZ OSCAR GIOVANNY


SISTEMAS OPERATIVOS 9

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>

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;
res2.setText("La resta es "+ r);
}

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


// TODO add your handling code here:
System.exit(0);
}

ARZATE MARTINEZ OSCAR GIOVANNY


SISTEMAS OPERATIVOS 10

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


Double x=Double.parseDouble(c1.getText());
Double y=Double.parseDouble(c2.getText());
Double r=x+y;
res.setText("la suma es "+ r);
}

private void multiplicarActionPerformed(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;
res3.setText("La Multiplicacion es "+ r);
}

private void dividirActionPerformed(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;
res4.setText("La Division es "+ r);
}

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


// TODO add your handling code here:
c1.setText("");
c2.setText("");
res.setText("");
res2.setText("");
res3.setText("");
res4.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) ">
/* 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

ARZATE MARTINEZ OSCAR GIOVANNY


SISTEMAS OPERATIVOS 11

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

/* Create and display the form */


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

// Variables declaration - do not modify


private javax.swing.JButton Limpiar;
private javax.swing.JTextField c1;
private javax.swing.JTextField c2;
private javax.swing.JButton dividir;
private javax.swing.JLabel j1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;

ARZATE MARTINEZ OSCAR GIOVANNY


SISTEMAS OPERATIVOS 12

private javax.swing.JButton multiplicar;


private javax.swing.JLabel res;
private javax.swing.JLabel res2;
private javax.swing.JLabel res3;
private javax.swing.JLabel res4;
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