Documentos de Académico
Documentos de Profesional
Documentos de Cultura
INSTRUCCIONES
CASO PROPUESTO 1
Se necesita una aplicacin informtica que calcule el total a facturar por la
compra de los siguientes productos (debe representarse con casillas de
verificacin):
Producto
Costo (US $)
CASE
Microprocesador
Memoria
Mainboard
Disco Duro
Monitor
Teclado
Mouse
32.00
75
48
70
120
130
5
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 diseo de formulario de acuerdo a su criterio, utilice controles
checkbox (casillas de verificacin) y radiobuttons (botones de opcin de
grupo).
DESARROLLO:
Java:
}
private void calcularActionPerformed(java.awt.event.ActionEvent evt) {
double cuenta=0;
double total=0;
double descuento=0;
if (check1.isSelected())
if (check2.isSelected())
{
cuenta++;
total+=75;
}
if (check3.isSelected())
{
cuenta++;
total+=48;
}
if (check4.isSelected())
{
cuenta++;
total+=70;
}
if (check5.isSelected())
{
cuenta++;
total+=120;
}
if (check6.isSelected())
{
if (rb8.isSelected())
{
descuento=0.8*total;
}
if(rb5.isSelected())
{
descuento=0.05*total;
txtelementosseleccionados.setText(String.valueOf(cuenta));
txttotalapagar.setText(String.valueOf(total));
txttotaldedescuento.setText(String.valueOf(descuento));
txtnetoapagar.setText(String.valueOf(total-descuento));
add your handling code here:
}
// TODO
/**
* @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(factura.class.getName()).log(java.util.logg
ing.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(factura.class.getName()).log(java.util.logg
ing.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(factura.class.getName()).log(java.util.logg
ing.Level.SEVERE, null, ex);