Practicas Java

Share Embed Donate


Short Description

Download Practicas Java...

Description

PRACTICAS /*@author UNE-TELESUP*/ import javax.swing.*; public class mayormenor{ public static void main(String[] args){ String valor1,valor2; valor1=JOptionPane.showInputDialog(null,"ingrese 1er Numero","",1); int n=Integer.parseInt(valor1); valor2=JOptionPane.showInputDialog(null,"ingrese 2do Numero","",1); int n1=Integer.parseInt(valor2); if (n >n1) System.out.println("Es mayor..."); Else System.out.println("Es menor...");

import javax.swing.*; public class importes{ public static void main(String[] args) { String cd,ar,cant,pu; double importe; cd=JOptionPane.showInputDialog(null,"ingrese codigo de cliente","",1); ar=JOptionPane.showInputDialog(null,"ingrese articulo","",1); cant=JOptionPane.showInputDialog(null,"ingrese cantidad","",1); pu=JOptionPane.showInputDialog(null,"ingrese precio unitario","",1); int v1=Integer.parseInt(cant); int v2=Integer.parseInt(pu); importe=v1*v2; JOptionPane.showMessageDialog(null,"el importe es:"+importe); } }

import javax.swing.* public class triangulo{ public static void main(String[] args){

String b,al; double area; b=JOptionPane.showInputDialog(null,"ingrese base","",1); al=JOptionPane.showInputDialog(null,"ingrese altura","",1); int v1=Integer.parseInt(b); int v2=Integer.parseInt(al); if((v1>0)&& (v2>0)){ area=(v1*v2)/2; JOptionPane.showMessageDialog(null,"el area es:"+area); }else{ JOptionPane.showMessageDialog(null,"error de datos"); } } }

import javax.swing.*; public class notas{ public static void main(String[] args){ String nt,nc,ne; double promedio=0.00; nt=JOptionPane.showInputDialog(null,"ingrese nota de practicas","",1); nc=JOptionPane.showInputDialog(null,"ingrese nota de cuaderno","",1); ne=JOptionPane.showInputDialog(null,"ingrese nota de examen","",1); int n=Integer.parseInt(nt); int n1=Integer.parseInt(nc); int n2=Integer.parseInt(ne); promedio=(n+n1+n2)/3; if(promedio>=11){ JOptionPane.showMessageDialog(null,"usted aprobo el curso"); }else{ JOptionPane.showMessageDialog(null,"usted desaprobo el curso"); } JOptionPane.showMessageDialog(null,"el promedio obtenido es:"+promedio); }}

import javax.swing.*; public class sumacifras{ public static void main(String[] args){ //Definiendo variables String c;long suma=0; //Obteniendo # como texto c=JOptionPane.showInputDialog(null,"ingrese numero de 3 cifras","",1); //Convirtiendo el numero en entero int n=Integer.parseInt(c); //Descomponiendo el # en centenas,decenas y unidades long cen=n/100; long res=n%100; long dec=res/10; long uni=res%10; //Calculando la suma de lasa cifras suma=cen+dec+uni; //Imprimiendo la suma de las cifras JOptionPane.showMessageDialog(null,"la suma de sus cifras es:"+suma); } }

import javax.swing.*; public class numeroprimo { public static void main(String[] args){ String c; c=JOptionPane.showInputDialog(null,"ingrese numero","",1); int n=Integer.parseInt(c); if(n%1==0 && n%n==0 && n%2!=0){ JOptionPane.showMessageDialog(null,"El # "+n+" es primo"); }else{ JOptionPane.showMessageDialog(null,"El # "+n+" no es primo"); } } } __________________________________________________________________________ _

import javax.swing.*; public class numeroreves{

public static void main(String[] args){ String c; c=JOptionPane.showInputDialog(null,"ingrese numero","",1); StringBuffer c1=new StringBuffer(c); StringBuffer c2=c1.reverse(); JOptionPane.showMessageDialog(null,"El numero al rev├ęs es:"+c2); } }

import javax.swing.*; public class lanzadados { public static void main(String[] args){ int i=1,c=0; while(i
View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF