Académique Documents
Professionnel Documents
Culture Documents
N de Cuenta: 31241249
Descripcin de problema.
Apartamentos Rodrguez
Una pequea empresa que se dedica a alquilar apartamentos ofrece los siguientes
dependiendo contrato:
Clasificacin
1
2
Descripcin
Sencillo (1 Habitacin)
Doble (2 Habitaciones)
Tipo de alquiler
L. 3500.00
L. 6000.00
Por polticas de la empresa solo se ofrecen 2 tipos de contrato: 6 meses y 12 meses para
alquilar para ambos apartamentos.
Para el apartamento sencillo se ofrecen con camas personales y para el doble se ofrecen con
camas matrimoniales.
Para el apartamento sencillo se ofrece servicio de parqueo a L.1000.00 y servicios
acondicionantes a L. 1500.00 sin importar el tipo de contracto.
Para el apartamento doble se ofrece servicio de parqueo a L.2000.00 y servicios
acondicionantes a L. 2500.00 sin importar el tipo de contracto.
package javaapplication28;
@SuppressWarnings("unchecked")
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
nombre.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
nombreActionPerformed(evt);
}
});
buttonGroup1.add(opcion1);
opcion1.setText("Sencillo (una habitacion)");
buttonGroup1.add(opcion2);
opcion2.setText("Doble (dos habitaciones)");
opcion2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
opcion2ActionPerformed(evt);
}
});
buttonGroup3.add(si);
si.setText("Si");
si.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
siActionPerformed(evt);
}
});
buttonGroup3.add(no);
no.setText("No");
buttonGroup2.add(opcion3);
opcion3.setText("6 meses");
buttonGroup2.add(opcion4);
opcion4.setText("1 ao");
buttonGroup4.add(positivo);
positivo.setText("Si");
buttonGroup4.add(negativo);
negativo.setText("No");
ejecutar.setText("Calcular");
ejecutar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ejecutarActionPerformed(evt);
}
});
.addComponent(opcion2)
.addComponent(opcion1)
.addComponent(jLabel4)
.addGroup(layout.createSequentialGroup()
.addComponent(texto2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(identidad, javax.swing.GroupLayout.PREFERRED_SIZE, 238,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(texto1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(nombre, javax.swing.GroupLayout.PREFERRED_SIZE, 244,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(si)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(no)))
.addContainerGap(104, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(135, 135, 135))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(ejecutar, javax.swing.GroupLayout.PREFERRED_SIZE, 129,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(29, 29, 29))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(texto1)
.addComponent(nombre, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(texto2)
.addComponent(identidad, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jLabel4)
.addGap(18, 18, 18)
.addComponent(opcion1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(opcion2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(opcion3)
.addGap(1, 1, 1)
.addComponent(opcion4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(si)
.addComponent(no))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(positivo)
.addComponent(negativo))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ejecutar, javax.swing.GroupLayout.PREFERRED_SIZE, 34,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(20, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
}
catch(Exception e){ // Si no se ejecuta codigo enviar excepcion
identidad.setText(""); // Declaracin para mostrar Texto
texto2.setText("Solo se admiten numeros enteros sin guiones"); // Texto a mostar en caso de error
bandera = true; // Si cumple con los requisitos variable se actualiza
}
//<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(entrada.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(entrada.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(entrada.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(entrada.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new entrada().setVisible(true);
}
});
}
}
// Declaracin de variables no modificables
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.ButtonGroup buttonGroup2;
private javax.swing.ButtonGroup buttonGroup3;
private javax.swing.ButtonGroup buttonGroup4;
private javax.swing.JButton ejecutar;
package javaapplication28;
public void setActualizar(double sa, double sp,String nom,double identi,double apartamento, boolean op1 ,
boolean op2 , boolean op3 ,boolean op4, boolean s , boolean n,boolean pos, boolean neg){ // Declaracion de
Metodo setActualizar para actualizar las variables de clase.
package javaapplication28;
import javax.swing.JOptionPane;
public calculo() {
this.nombre= ""; // Inicializacin de Variable String
this.identidad = 0; // Inicializacin de Variable Double
this.apartamento= 0; // Inicializacin de Variable Double
this.tiempo = 0; // Inicializacin de Variable Double
this.sa = 0; // Inicializacin de Variable Double
this.sp = 0; // Inicializacin de Variable Double
this.opcion1 = false; // Inicializacin de Variable boolean
this.opcion2 = false; // Inicializacin de Variable boolean
this.opcion3 = false; // Inicializacin de Variable boolean
this.opcion4 = false; // Inicializacin de Variable boolean
this.si = false; // Inicializacin de Variable boolean
this.no = false; // Inicializacin de Variable boolean
this.positivo = false; // Inicializacin de Variable boolean
this.negativo = false; // Inicializacin de Variable boolean
}
public void setInicio(double sa, double sp,String nom,double identi,double apartamento,double tiempo,boolean
op1, boolean op2 , boolean op3,boolean op4, boolean s , boolean n,boolean pos , boolean neg){ // Declaracion de
Metodo setInicio para actualizar las variables de clase.
JOptionPane.showMessageDialog(null, "Se cobrara 3,500 lps mensuales por el apartamento sencillo durante 6
meses"); // Mostrar Mensaje
}
if(this.opcion4){ // Condicionante si elige opcion 4
apartamento = 3500 * 12; // Calculo de la variable apartamento
JOptionPane.showMessageDialog(null, "Se cobrara 3,500 lps mensuales por el apartamento sencillo durante 12
meses"); // Mostrar Mensaje
}
package javaapplication28;
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel2.setText("LPS.");
regresar.setText("Regresar");
regresar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
regresarActionPerformed(evt);
}
});
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addGap(93, 93, 93)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(total, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 93, Short.MAX_VALUE)
.addComponent(regresar, javax.swing.GroupLayout.PREFERRED_SIZE, 58,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
pack();
}// </editor-fold>
//<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 {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new salida().setVisible(true);
}
});
}