10.05.2014 Views

programación i - Universidad ORT Uruguay

programación i - Universidad ORT Uruguay

programación i - Universidad ORT Uruguay

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

152 Programación I<br />

}<br />

public void setLado3(int unLado){<br />

lado3 = unLado;<br />

}<br />

// métodos varios<br />

public boolean esEscaleno() {<br />

return (this.getLado1() != this. getLado2()) && (this. getLado1()!= this.getLado3()) &&<br />

(this. getLado2() != this. getLado3());<br />

}<br />

}<br />

public boolean esEquilatero() {<br />

return (this. getLado1() == this. getLado2()) && (this. getLado1()== this. getLado3());<br />

}<br />

public boolean esIsosceles() {<br />

return !this.esEquilatero() &&<br />

( (this. getLado1() == this. getLado2()) ||<br />

(this. getLado1() == this.getLado3()) ||<br />

(this. getLado2() == this.getLado3()) ) ;<br />

// metodo de prueba<br />

public static void main (String args[] ) {<br />

Triangulo unEs = new Triangulo(10,20,30);<br />

Triangulo unIs = new Triangulo(10,20,10);<br />

Triangulo unEq = new Triangulo(10,10,10);<br />

System.out.println("Es escaleno "+ unEs.esEscaleno());<br />

System.out.println("Es isosceles "+ unIs.esIsosceles());<br />

System.out.println("Es equilatero "+ unEq.esEquilatero());<br />

}<br />

3,4)<br />

package funcionario;<br />

import java.util.Scanner;<br />

public class Funcionario {<br />

// variables de instancia<br />

private String nombre;<br />

private double sueldo;<br />

private String telefono;<br />

// acceso y modificacion<br />

public void setNombre(String unNombre) {<br />

nombre = unNombre;<br />

}<br />

public String getNombre() {<br />

return nombre;<br />

}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!