Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package task3;
- class Triangle {
- int x,y,z;
- public double area(){
- double s = (x+y+z)/2;
- return Math.pow((s*(s-x)*(s-y)*(s-z)),.5);
- }
- public double perimeter(){
- return (x+y+z)/2;
- }
- }
- public class Task3 {
- public static void main(String[] args) {
- Triangle t = new Triangle();
- t.x= 3;
- t.y = 4;
- t.z = 5;
- System.out.println(t.area());
- System.out.println(t.perimeter());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment