Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Nuevo documento de texto java


Published on

  • Be the first to comment

  • Be the first to like this

Nuevo documento de texto java

  1. 1. package triangulo; import java.util.Scanner; public class Triangulo { private int base, altura, lado1, lado2, lado3; private float Area; private int Perimetro; public Triangulo() { Scanner teclado = new Scanner(; System.out.println("Ingrese base del triángulo"); base = teclado.nextInt(); System.out.println("Ingrese altura del triángulo"); altura = teclado.nextInt(); System.out.println("Ingrese lado 1 triángulo"); lado1 = teclado.nextInt(); System.out.println("Ingrese lado 2 triángulo"); lado2 = teclado.nextInt(); } public void hallarArea() { Area = base*altura/2; System.out.println("El Area Es : "+Area); } public void hallarPerimetro() { Perimetro = base + lado1 + lado2; System.out.println("El perimetro es: " + Perimetro); } public static void main(String[] args) { // Triangulo objeto = new Triangulo(); // objeto.hallarPerimetro(); Triangulo objeto2 = new Triangulo(); objeto2.hallarArea(); } }