Está en la página 1de 2

package telefonia; import javax.swing.

JOptionPane; public class Telefonia { public static void main (String [] args)

{//para inicio de la aplicacion principal (cuerpo) int A = 1; while (A == 1) {// Inicio del While principal de solicitar continuar JOptionPane.showMessageDialog(null,"Este programa nos determina la cantidad a " + "pagar de una cuenta" + " telefonica de un mes","ICETICO PROG10", JOptionPane.INFORMATION_MESSAGE );//el usuario pone el numero o inserta datos int mh=0, cll=0; int costollamada=0, descuento=0; String nomu= JOptionPane.showInputDialog(" Nombre"); String tel= JOptionPane.showInputDialog("Numero de telefono"); mh= Integer.parseInt(JOptionPane.showInputDialog("Minutos que hablo")); cll= Integer.parseInt (JOptionPane.showInputDialog("Cantidad de llamadas " + "que realizo"));

if(mh>0 && mh<=50) { costollamada=(mh)*(1000); } if(mh>51 && mh<100) { costollamada=(mh)*(1200); } if(mh>101 && mh<200) { costollamada=(mh)*(1500); } if(mh>201 && mh<300) { costollamada=(mh)*(2000); } if(mh>300) { costollamada=(mh)*(2500); }

if(cll>=0 && cll<=20) //DESCUENTO 5% JOptionPane.showMessageDialog(null,"CANTIDAD DE MINUTOS: "+ cll + "\nCANTIDAD DE LLAMADAS: " + mh +"\nSE APLICA UN 5% DE DESCUENTO"+"\nTOTAL: "+(costollamada-(costollamada*0.05))+ "\n NUMERO DE TEL: " +tel +"\n CLIENTE : "+ nomu, "ICETICO PROG10", JOptionPane.INFORMATION_MESSAGE ); if(cll>=21 && cll<=100) //DESCUENTO 7%

JOptionPane.showMessageDialog(null,"CANTIDAD DE MINUTOS: "+ cll + "\nCANTIDAD DE LLAMADAS: " + mh +"\nSE APLICA UN 7% DE DESCUENTO"+"\nTOTAL: "+(costollamada-(costollamada*0.07))+ "\n NUMERO DE TEL: " +tel +"\n CLIENTE : "+ nomu, "ICETICO PROG10", JOptionPane.INFORMATION_MESSAGE ); if(cll>=101 & cll<=200) //DESCUENTO 9%

JOptionPane.showMessageDialog(null,"CANTIDAD DE MINUTOS: "+ cll + "\nCANTIDAD DE LLAMADAS: " + mh +"\nSE APLICA UN 9% DE DESCUENTO"+"\nTOTAL: "+(costollamada-(costollamada*0.09))+ "\n NUMERO DE TEL: " +tel +"\n CLIENTE : "+ nomu, "ICETICO PROG10", JOptionPane.INFORMATION_MESSAGE ); if(cll>201) //DESCUENTO 10%

JOptionPane.showMessageDialog(null,"CANTIDAD DE MINUTOS: "+ cll + "\nCANTIDAD DE LLAMADAS: " + mh +"\nSE APLICA UN 10% DE DESCUENTO"+"\nTOTAL: "+(costollamada-(costollamada*0.1))+ "\n NUMERO DE TEL: " +tel +"\n CLIENTE : "+ nomu, "ICETICO PROG10", JOptionPane.INFORMATION_MESSAGE ); A = Integer.parseInt (JOptionPane.showInputDialog(" Digite 1 si desea continuar con otro dato de lo contrario presione cualquier tecla ")); } // fin del while principal } }

También podría gustarte