Docsity

Java program for calculating the distance, Assignments of Local Area Network (LAN)

Partial preview of the text

Download Java program for calculating the distance and more Assignments Local Area Network (LAN) in PDF only on Docsity!

class MyRectangle2D{ private double x; private double y; private double width; private double height; public MyRectangle2D(){ x=0; y=0; width = 1; height = 1; } public MyRectangle2D(double x, double y, double w, double h){ this.x=x; this.y=y; width = w; height = h; } public double getx(){ return x; } public double gety(){ return y; } public double getw(){ return width;

public double geth(){ return height; } public void setx(double x){ this.x=x; } public void sety(double y){ this.y=y; } public void setw(double w){ width=w; } public void seth(double h){ height=h; } public double getArea(){ return (widthheight); } public double getPerimeter(){ return (2(width+height)); } public void print(){ System.out.println("Width of the rectangle = " + width);

System.out.println(r2.getArea()); System.out.println(r2.getPerimeter()); System.out.println(r2.contains(11,33)); r2.print(); System.out.println(r2.contains(r1)); System.out.println(r1.contains(r2)); } }