instrucciones

21
INSTRUCCIONES CASO PROPUESTO 1 Se necesita una aplicación informática que calcule el total a facturar por la compra de los siguientes productos (debe representarse con casillas de verificación): Producto Costo (US $) CASE 32.00 Microprocesador 75 Memoria 48 Mainboard 70 Disco Duro 120 Monitor 130 Teclado 5 Mouse 5 Lector de CD ROM 12 Adicionalmente que tipo de descuento se hará efectivo, existen las siguientes posibilidades: 0%, 5%, 8% (Deben representarse con radiobuttons) Calcular el costo total de los productos y el descuento pertinente. Crear el diseño de formulario de acuerdo a su criterio, utilice controles checkbox (casillas de verificación) y radiobuttons (botones de opción de grupo). CASO PROPUESTO 2 Crear una aplicación Java que resuelva el siguiente caso práctico: Se necesita una aplicación informática que ayude a calcular los haberes mensuales de los trabajadores de una empresa, para lo cual se le pide a Ud. que desarrolle el siguiente programa: Luego de ingresar el monto de sueldo básico mensual, se debe seleccionar con casillas de verificación, las bonificaciones a las cuales el trabajador está afecto (pueden ser una, varias o ninguna). Tipo de Bonificación Porcentaje de Bonificación con relación al sueldo básico Familiar 8% Productividad 10% Escolaridad S/. 150.00 Adicionalmente señalar el sistema de pensiones al cual está afiliado el trabajador (sólo se puede escoger una de cualquiera de las dos opciones) Tipo de Sistema de Administración de Pensiones Porcentaje de Descuento con relación al sueldo básico SNP (Sistema Nacional de Pensiones) 11% AFP (Administración de Fondo de Pensiones) 13% Luego de seleccionar las bonificaciones y el tipo de sistema de administración de pensiones hacer click en el botón calcular, para hallar: el monto total de la bonificación, el monto total de descuento y el neto a percibir.

Upload: jaime-chuquiarque-angeles

Post on 16-Jan-2016

14 views

Category:

Documents


0 download

DESCRIPTION

jaime

TRANSCRIPT

Page 1: Instrucciones

INSTRUCCIONES CASO PROPUESTO 1

Se necesita una aplicación informática que calcule el total a facturar por la compra de los siguientes productos (debe representarse con casillas de verificación):

Producto Costo (US $)

CASE 32.00

Microprocesador 75

Memoria 48

Mainboard 70

Disco Duro 120

Monitor 130

Teclado 5

Mouse 5

Lector de CD ROM 12

Adicionalmente que tipo de descuento se hará efectivo, existen las siguientes posibilidades: 0%, 5%, 8% (Deben representarse con radiobuttons)

Calcular el costo total de los productos y el descuento pertinente.

Crear el diseño de formulario de acuerdo a su criterio, utilice controles checkbox (casillas de verificación) y radiobuttons (botones de opción de grupo).

CASO PROPUESTO 2

Crear una aplicación Java que resuelva el siguiente caso práctico:

Se necesita una aplicación informática que ayude a calcular los haberes mensuales de los trabajadores de una empresa, para lo cual se le pide a Ud. que desarrolle el

siguiente programa:

Luego de ingresar el monto de sueldo básico mensual, se debe seleccionar con casillas de verificación, las bonificaciones a las cuales el trabajador está afecto (pueden ser

una, varias o ninguna).

Tipo de BonificaciónPorcentaje de Bonificación con relación al

sueldo básico

Familiar 8%

Productividad 10%

Escolaridad S/. 150.00

Adicionalmente señalar el sistema de pensiones al cual está afiliado el trabajador (sólo se puede escoger una de cualquiera de las dos opciones)

Tipo de Sistema de Administración de PensionesPorcentaje de Descuento con relación al sueldo

básico

SNP (Sistema Nacional de Pensiones) 11%

AFP (Administración de Fondo de Pensiones) 13%

Luego de seleccionar las bonificaciones y el tipo de sistema de administración de pensiones hacer click en el botón calcular, para hallar: el monto total de la bonificación,

el monto total de descuento y el neto a percibir.

Crear el diseño de formulario de acuerdo a su criterio y lo enseñado en la última clase, utilice controles checkbox (casillas de verificación) y radiobuttons (botones de

opción de grupo).

Caso 1:

/* * PC.java

Page 2: Instrucciones

* * Created on 12-may-2014, 23:05:59 *//** * * @author jaime */public class PC extends javax.swing.JFrame {

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

@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() {

jInternalFrame1 = new javax.swing.JInternalFrame(); jLabel1 = new javax.swing.JLabel(); check1 = new javax.swing.JCheckBox(); check2 = new javax.swing.JCheckBox(); check3 = new javax.swing.JCheckBox(); check4 = new javax.swing.JCheckBox(); check5 = new javax.swing.JCheckBox(); check6 = new javax.swing.JCheckBox(); check7 = new javax.swing.JCheckBox(); check8 = new javax.swing.JCheckBox(); check9 = new javax.swing.JCheckBox(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); rb0 = new javax.swing.JRadioButton(); rb5 = new javax.swing.JRadioButton(); rb8 = new javax.swing.JRadioButton(); jLabel12 = new javax.swing.JLabel(); txtelementosseleccionados = new javax.swing.JTextField(); calcular = new javax.swing.JButton(); jLabel13 = new javax.swing.JLabel(); txttotalapagar = new javax.swing.JTextField(); jLabel14 = new javax.swing.JLabel(); txttotaldedescuento = new javax.swing.JTextField(); jLabel15 = new javax.swing.JLabel(); txtnetoapagar = new javax.swing.JTextField(); limpiar = new javax.swing.JButton(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); jMenu2 = new javax.swing.JMenu(); jMenu3 = new javax.swing.JMenu();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jInternalFrame1.setVisible(true);

jLabel1.setText("SELECCIONE PRODUCTO");

check1.setText("CASE");

check2.setText("Microprocesador");

check3.setText("Memoria");

check4.setText("Mainboard");

check5.setText("Disco Duro");

check6.setText("Monitor");

check7.setText("Teclado");

check8.setText("Mouse");

check9.setText("Lectora de CD ROM");

jLabel2.setText("$ 32");

jLabel3.setText("$ 75");

jLabel4.setText("$ 48");

Page 3: Instrucciones

jLabel5.setText("$ 70");

jLabel6.setText("$ 120");

jLabel7.setText("$ 130");

jLabel8.setText("$ 5");

jLabel9.setText("$ 5");

jLabel10.setText("$ 12");

jLabel11.setText("DESCUENTO");

rb0.setText("0%");

rb5.setText("5%");

rb8.setText("8%");

jLabel12.setText("ELEMENTOS SELECCIONADOS");

calcular.setText("CALCULAR"); calcular.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { calcularActionPerformed(evt); } });

jLabel13.setText("TOTAL A PAGAR:");

jLabel14.setText("TOTAL DE DESCUENTO:");

jLabel15.setText("NETO A PAGAR:");

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

jMenu1.setText("ayuda"); jMenuBar1.add(jMenu1);

jMenu2.setText("acerca de"); jMenuBar1.add(jMenu2);

jMenu3.setText("salir"); jMenuBar1.add(jMenu3);

jInternalFrame1.setJMenuBar(jMenuBar1);

javax.swing.GroupLayout jInternalFrame1Layout = new javax.swing.GroupLayout(jInternalFrame1.getContentPane()); jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout); jInternalFrame1Layout.setHorizontalGroup( jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jInternalFrame1Layout.createSequentialGroup() .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jInternalFrame1Layout.createSequentialGroup() .addContainerGap() .addComponent(check9) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE) .addComponent(jLabel10)) .addGroup(jInternalFrame1Layout.createSequentialGroup() .addContainerGap() .addComponent(check8) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 96, Short.MAX_VALUE) .addComponent(jLabel9)) .addGroup(jInternalFrame1Layout.createSequentialGroup() .addContainerGap() .addComponent(check7) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 90, Short.MAX_VALUE) .addComponent(jLabel8)) .addGroup(jInternalFrame1Layout.createSequentialGroup() .addContainerGap() .addComponent(check6) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 80, Short.MAX_VALUE) .addComponent(jLabel7)) .addGroup(jInternalFrame1Layout.createSequentialGroup() .addContainerGap() .addComponent(check5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 64, Short.MAX_VALUE) .addComponent(jLabel6)) .addGroup(jInternalFrame1Layout.createSequentialGroup() .addContainerGap() .addComponent(check4)

Page 4: Instrucciones

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 72, Short.MAX_VALUE) .addComponent(jLabel5)) .addGroup(jInternalFrame1Layout.createSequentialGroup() .addContainerGap() .addComponent(check3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 82, Short.MAX_VALUE) .addComponent(jLabel4)) .addGroup(jInternalFrame1Layout.createSequentialGroup() .addContainerGap() .addComponent(check2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 42, Short.MAX_VALUE) .addComponent(jLabel3)) .addGroup(jInternalFrame1Layout.createSequentialGroup() .addContainerGap() .addComponent(check1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 96, Short.MAX_VALUE) .addComponent(jLabel2)) .addGroup(jInternalFrame1Layout.createSequentialGroup() .addGap(53, 53, 53) .addComponent(jLabel1))) .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jInternalFrame1Layout.createSequentialGroup() .addGap(102, 102, 102) .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(rb0) .addComponent(jLabel11) .addComponent(rb5) .addComponent(rb8))) .addGroup(jInternalFrame1Layout.createSequentialGroup() .addGap(60, 60, 60) .addComponent(jLabel12)) .addGroup(jInternalFrame1Layout.createSequentialGroup() .addGap(81, 81, 81) .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(calcular) .addComponent(txtelementosseleccionados, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGap(84, 84, 84)) .addGroup(jInternalFrame1Layout.createSequentialGroup() .addContainerGap() .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel13) .addComponent(jLabel14) .addComponent(jLabel15)) .addGap(37, 37, 37) .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(txtnetoapagar) .addComponent(txttotaldedescuento) .addComponent(txttotalapagar, javax.swing.GroupLayout.DEFAULT_SIZE, 127, Short.MAX_VALUE)) .addGap(35, 35, 35) .addComponent(limpiar, javax.swing.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE) .addGap(24, 24, 24)) ); jInternalFrame1Layout.setVerticalGroup( jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jInternalFrame1Layout.createSequentialGroup() .addGap(20, 20, 20) .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(jLabel11)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jInternalFrame1Layout.createSequentialGroup() .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(check1) .addComponent(jLabel2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(check2) .addComponent(jLabel3)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(check3) .addComponent(jLabel4)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(check4) .addComponent(jLabel5)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(check5) .addComponent(jLabel6)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(check6) .addComponent(jLabel7)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

Page 5: Instrucciones

.addComponent(check7) .addComponent(jLabel8)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(check8) .addComponent(jLabel9) .addComponent(calcular)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(check9) .addComponent(jLabel10))) .addGroup(jInternalFrame1Layout.createSequentialGroup() .addGap(6, 6, 6) .addComponent(rb0) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(rb5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(rb8) .addGap(18, 18, 18) .addComponent(jLabel12) .addGap(18, 18, 18) .addComponent(txtelementosseleccionados, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jInternalFrame1Layout.createSequentialGroup() .addGap(36, 36, 36) .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel13) .addComponent(txttotalapagar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel14) .addComponent(txttotaldedescuento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel15) .addComponent(txtnetoapagar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(10, 10, 10)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jInternalFrame1Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(limpiar, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(31, 31, 31)))) );

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jInternalFrame1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(270, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jInternalFrame1, javax.swing.GroupLayout.DEFAULT_SIZE, 470, Short.MAX_VALUE) );

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

private void calcularActionPerformed(java.awt.event.ActionEvent evt) { double cuenta = 0;

double total = 0;

double descuento = 0;

if (check1.isSelected()) {

cuenta++;

total += 32;

}

if (check2.isSelected()) {

cuenta++;

total += 75;

Page 6: Instrucciones

}

if (check3.isSelected()) {

cuenta++;

total += 48;

}

if (check4.isSelected()) {

cuenta++;

total += 70;

}

if (check5.isSelected()) {

cuenta++;

total += 120;

}

if (check6.isSelected()) {

cuenta++;

total += 130;

}

if (check7.isSelected()) {

cuenta++;

total += 5;

}

if (check8.isSelected()) {

cuenta++;

total += 5;

}

if (check9.isSelected()) {

cuenta++;

total += 12;

}

if (rb8.isSelected()) {

descuento = 0.8 * total;

}

if (rb5.isSelected()) {

descuento = 0.05 * total;

} else if (rb0.isSelected()) {

descuento = 0;

}

txtelementosseleccionados.setText(String.valueOf(cuenta));

txttotalapagar.setText(String.valueOf(total));

txttotaldedescuento.setText(String.valueOf(descuento));

txtnetoapagar.setText(String.valueOf(total - descuento));

Page 7: Instrucciones

}

private void limpiarActionPerformed(java.awt.event.ActionEvent evt) { txtelementosseleccionados.setText("");

txttotalapagar.setText("");

txttotaldedescuento.setText("");

txtnetoapagar.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 */ 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(PC.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(PC.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(PC.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(PC.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold>

/* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() {

@Override public void run() { new PC().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JButton calcular; private javax.swing.JCheckBox check1; private javax.swing.JCheckBox check2; private javax.swing.JCheckBox check3; private javax.swing.JCheckBox check4; private javax.swing.JCheckBox check5; private javax.swing.JCheckBox check6; private javax.swing.JCheckBox check7; private javax.swing.JCheckBox check8; private javax.swing.JCheckBox check9; private javax.swing.JInternalFrame jInternalFrame1; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JMenu jMenu1; private javax.swing.JMenu jMenu2; private javax.swing.JMenu jMenu3; private javax.swing.JMenuBar jMenuBar1; private javax.swing.JButton limpiar; private javax.swing.JRadioButton rb0; private javax.swing.JRadioButton rb5; private javax.swing.JRadioButton rb8; private javax.swing.JTextField txtelementosseleccionados; private javax.swing.JTextField txtnetoapagar; private javax.swing.JTextField txttotalapagar; private javax.swing.JTextField txttotaldedescuento;

Page 8: Instrucciones

// End of variables declaration}

Caso 2

/**

*

* @author jaime

*/

public class bonificacion extends javax.swing.JFrame {

/** Creates new form bonificacion */

public bonificacion() {

initComponents();

}

@SuppressWarnings("unchecked")

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

private void initComponents() {

txtingresesueldo = new javax.swing.JTextField();

txtbonificacion = new javax.swing.JTextField();

txtdescuento = new javax.swing.JTextField();

txtrecibir = new javax.swing.JTextField();

txt1 = new javax.swing.JTextField();

Page 9: Instrucciones

jLabel1 = new javax.swing.JLabel();

jLabel2 = new javax.swing.JLabel();

check1 = new javax.swing.JCheckBox();

check2 = new javax.swing.JCheckBox();

check3 = new javax.swing.JCheckBox();

jLabel3 = new javax.swing.JLabel();

radio1 = new javax.swing.JRadioButton();

radio2 = new javax.swing.JRadioButton();

jLabel4 = new javax.swing.JLabel();

jLabel5 = new javax.swing.JLabel();

jLabel6 = new javax.swing.JLabel();

jLabel7 = new javax.swing.JLabel();

jLabel8 = new javax.swing.JLabel();

jLabel9 = new javax.swing.JLabel();

jLabel10 = new javax.swing.JLabel();

jLabel11 = new javax.swing.JLabel();

botoncalcular = new javax.swing.JButton();

botonlimpiar = new javax.swing.JButton();

jSeparator1 = new javax.swing.JSeparator();

jSeparator2 = new javax.swing.JSeparator();

jSeparator3 = new javax.swing.JSeparator();

jSeparator4 = new javax.swing.JSeparator();

jSeparator5 = new javax.swing.JSeparator();

jSeparator6 = new javax.swing.JSeparator();

jMenuBar1 = new javax.swing.JMenuBar();

jMenu1 = new javax.swing.JMenu();

jMenu2 = new javax.swing.JMenu();

jMenu3 = new javax.swing.JMenu();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jLabel1.setText("INGRESE SUELDO");

jLabel2.setText("SELECCIONE BONIFICACION");

check1.setText("familia");

Page 10: Instrucciones

check2.setText("productividad");

check3.setText("escolaridad");

jLabel3.setText("SISTEMA DE PENCIONES AFILIADO (DESCUENTO)");

radio1.setText("SNP (SISTEMA NACIONAL DE PENSIONES)");

radio2.setText("AFP (ADMINISTRACION DE FONDO DE PENSIONES)");

jLabel4.setText("8%");

jLabel5.setText("10%");

jLabel6.setText("s/ 150");

jLabel7.setText("11%");

jLabel8.setText("13%");

jLabel9.setText("TOTAL DE BONIFICACION");

jLabel10.setText("TOTAL DE DESCUENTO");

jLabel11.setText("TOTAL RECIBIDO");

botoncalcular.setText("CALCULAR");

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

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

botoncalcularActionPerformed(evt);

}

});

botonlimpiar.setText("LIMPIAR");

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

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

botonlimpiarActionPerformed(evt);

Page 11: Instrucciones

}

});

jMenu1.setText("ayuda");

jMenuBar1.add(jMenu1);

jMenu2.setText("acerca de");

jMenuBar1.add(jMenu2);

jMenu3.setText("salir");

jMenuBar1.add(jMenu3);

setJMenuBar(jMenuBar1);

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

.addGroup(layout.createSequentialGroup()

.addContainerGap()

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

.addComponent(jLabel9)

.addGroup(layout.createSequentialGroup()

.addGap(90, 90, 90)

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

.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)))

.addComponent(jLabel11)

.addComponent(jLabel10)

.addGroup(layout.createSequentialGroup()

.addGap(23, 23, 23)

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

.addComponent(check2)

.addComponent(check1)

.addComponent(check3)

Page 12: Instrucciones

.addComponent(jLabel2))))

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

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

.addGroup(layout.createSequentialGroup()

.addGap(5, 5, 5)

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

.addGroup(layout.createSequentialGroup()

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

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

.addComponent(txtrecibir)

.addComponent(txtdescuento, javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(txtbonificacion, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 467, Short.MAX_VALUE))

.addGroup(layout.createSequentialGroup()

.addGap(306, 306, 306)

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

.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jSeparator5, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)))

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

.addComponent(jLabel5)

.addComponent(jLabel4)

.addComponent(jLabel6)))

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

.addGroup(layout.createSequentialGroup()

.addGap(132, 132, 132)

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

.addComponent(radio1)

.addComponent(radio2))

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

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

.addComponent(botonlimpiar, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGroup(layout.createSequentialGroup()

.addGap(191, 191, 191)

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

.addComponent(jLabel7)

.addComponent(jLabel8)))))

.addGroup(layout.createSequentialGroup()

.addGap(310, 310, 310)

Page 13: Instrucciones

.addComponent(jSeparator6, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(layout.createSequentialGroup()

.addGap(303, 303, 303)

.addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))))

.addGroup(layout.createSequentialGroup()

.addComponent(txtingresesueldo, javax.swing.GroupLayout.PREFERRED_SIZE, 381, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(49, 49, 49)

.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)))

.addGap(477, 477, 477))

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

.addComponent(jLabel3)

.addGap(549, 549, 549))))

.addGroup(layout.createSequentialGroup()

.addGap(618, 618, 618)

.addComponent(botoncalcular)

.addGap(188, 188, 188)

.addComponent(txt1, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)))

.addContainerGap(241, Short.MAX_VALUE))

);

layout.setVerticalGroup(

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

.addGroup(layout.createSequentialGroup()

.addContainerGap()

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

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

.addComponent(jLabel1))

.addGap(18, 18, 18)

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

.addGroup(layout.createSequentialGroup()

.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(18, 18, 18)

.addComponent(jLabel2))

.addGroup(layout.createSequentialGroup()

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

.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(18, 18, 18)

Page 14: Instrucciones

.addComponent(jLabel3)))

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

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

.addGroup(layout.createSequentialGroup()

.addGap(28, 28, 28)

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

.addComponent(jLabel4)

.addComponent(check1))

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

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

.addComponent(jLabel5)

.addComponent(check2))

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

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

.addComponent(jLabel6)

.addComponent(check3)))

.addGroup(layout.createSequentialGroup()

.addGap(15, 15, 15)

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

.addComponent(jLabel7)

.addComponent(radio1))

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

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

.addComponent(jLabel8)

.addComponent(radio2))))

.addGap(18, 18, 18)

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

.addGroup(layout.createSequentialGroup()

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

.addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jSeparator5, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(25, 25, 25)

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

.addComponent(botoncalcular)

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

.addGap(32, 32, 32)

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

Page 15: Instrucciones

.addComponent(jLabel9)

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

.addComponent(jSeparator6, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE))

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

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

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

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

.addComponent(jLabel10))

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

.addComponent(jLabel11)

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

.addComponent(botonlimpiar, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)))

.addGap(107, 107, 107))

);

pack();

}// </editor-fold>

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

double sueldo1=0;

double sueldo2=0;

int cuenta=0;

double n1=0;

double total=0;

double descuento=0;

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

sueldo1=((n1*8)/100)+n1;

sueldo2=((n1*10)/100)+n1;

if (check1.isSelected())

{

cuenta++;

total+=((n1*8)/100);

}

if (check2.isSelected())

{

cuenta++;

total+=((n1*10)/100);

}

Page 16: Instrucciones

if (check3.isSelected())

{

cuenta++;

total+=150;

}

if (radio1.isSelected())

{

descuento=0.11*(total+n1);

}

if (radio2.isSelected())

{

descuento=0.13*(total+n1);

}

txtbonificacion.setText(String.valueOf(total+n1));

txtdescuento.setText(String.valueOf(descuento));

txtrecibir.setText(String.valueOf((total+n1)-descuento));

txt1.setText(String.valueOf(cuenta));

}

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

txtingresesueldo.setText("");

txtbonificacion.setText("");

txtdescuento.setText("");

txtrecibir.setText("");

txt1.setText("");

txtingresesueldo.grabFocus();

}

/**

* @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 {

Page 17: Instrucciones

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(bonificacion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (InstantiationException ex) {

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

} catch (IllegalAccessException ex) {

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

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

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

}

//</editor-fold>

/* Create and display the form */

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

@Override

public void run() {

new bonificacion().setVisible(true);

}

});

}

// Variables declaration - do not modify

private javax.swing.JButton botoncalcular;

private javax.swing.JButton botonlimpiar;

private javax.swing.JCheckBox check1;

private javax.swing.JCheckBox check2;

private javax.swing.JCheckBox check3;

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel10;

private javax.swing.JLabel jLabel11;

private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel3;

private javax.swing.JLabel jLabel4;

private javax.swing.JLabel jLabel5;

Page 18: Instrucciones

private javax.swing.JLabel jLabel6;

private javax.swing.JLabel jLabel7;

private javax.swing.JLabel jLabel8;

private javax.swing.JLabel jLabel9;

private javax.swing.JMenu jMenu1;

private javax.swing.JMenu jMenu2;

private javax.swing.JMenu jMenu3;

private javax.swing.JMenuBar jMenuBar1;

private javax.swing.JSeparator jSeparator1;

private javax.swing.JSeparator jSeparator2;

private javax.swing.JSeparator jSeparator3;

private javax.swing.JSeparator jSeparator4;

private javax.swing.JSeparator jSeparator5;

private javax.swing.JSeparator jSeparator6;

private javax.swing.JRadioButton radio1;

private javax.swing.JRadioButton radio2;

private javax.swing.JTextField txt1;

private javax.swing.JTextField txtbonificacion;

private javax.swing.JTextField txtdescuento;

private javax.swing.JTextField txtingresesueldo;

private javax.swing.JTextField txtrecibir;

// End of variables declaration

}

Page 19: Instrucciones