Docsity

Java program for my second assignment, Assignments of Local Area Network (LAN)

Partial preview of the text

Download Java program for my second assignment and more Assignments Local Area Network (LAN) in PDF only on Docsity!

class Circle{ private double x; private double y; private double radius; public Circle(){ x=0; y=0; radius=1; } public Circle(double x, double y, double radius){ this.x=x; this.y=y; this.radius=radius; } public double getx(){ return x; } public double gety(){ return y; } public double getr(){ return radius; } public void setx(double x){ this.x=x;

public void sety(double y){ this.y=y; } public void setr(double radius){ this.radius=radius; } public double getArea(){ return (Math.PIradiusradius); } public double getPerimeter(){ return (2Math.PIradius); } public void print(){ System.out.println("Center of the circle = (" + x + "," + y + ")"); System.out.println("Radius length of the circle = " + radius); } boolean contains(double x1, double y1){ double d=Math.sqrt(Math.pow((x1-x),2)+Math.pow((y1-y),2)); return(d<radius); } } public class Test {