joptionpane ejercicios

EJERCITACIÓN JAVA 2013 CÁTEDRA DE LENGUAJES ORIENTADOS A OBJETOS Ing. Mario Bressano & Luciano Diamand ENVÍO RESUELTO

Views 95 Downloads 1 File size 174KB

Report DMCA / Copyright

DOWNLOAD FILE

Recommend stories

Citation preview

EJERCITACIÓN JAVA

2013 CÁTEDRA DE LENGUAJES ORIENTADOS A OBJETOS Ing. Mario Bressano & Luciano Diamand

ENVÍO RESUELTO 05

LENGUAJES ORIENTADOS A OBJETOS

2013

Ejercicio 48: Dada la siguiente serie, confeccionar una aplicación donde ingresada la cantidad de términos calcule su valor. 1 + 1/2! + 1/3! + 1/4! + 1/5! + 1/6! +……+ 1/n! import javax.swing.JOptionPane ; import javax.swing.JTextArea; import java.text.DecimalFormat; public class Serie { public static void main (String[]args){ String cTer; int ter = 0; double fact; double sum = 0; int i; JTextArea areaTextoSalida = new JTextArea(); cTer = JOptionPane.showInputDialog("Ingrese la cantidad de terminos:"); ter = Integer.parseInt(cTer); fact =1; areaTextoSalida.setText("La serie de "+ ter+ " terminos es:\n "); DecimalFormat formato = new DecimalFormat("0.00"); for(i=1;i