Question: i need you make junit test class package Task1; /** * * @author tm2 */ public class Circle extends Shape { private Point center;//center private

i need you make junit test class

package Task1;

/** * * @author tm2 */ public class Circle extends Shape {

private Point center;//center private int radius;//radius

/** * * @param x * @param y * @param radius */ public Circle(int x, int y, int radius) { this.center = new Point(x, y); this.radius = radius; }

/** * * @param center * @param radius */ public Circle(Point center, int radius) { this.center = center; this.radius = radius; }

public Circle() { center = new Point(0, 0); radius = 1;

}

/** * * @return */ @Override public double getArea() { return Math.PI * radius * radius; // }

@Override public Point getCenter() { return this.center; }

/** * * @param center */ public void setCenter(Point center) { this.center = center; }

/** * * @return */ public int getRadius() { return radius; }

/** * * @param radius */ public void setRadius(int radius) { this.radius = radius; }

/** * * @return */ @Override public double getCircuference() {

return Math.PI * 2 * radius; }

/** * * @return */ @Override public String toString() { return "Circle (" + center.getX() + ", " + center.getY() + ") radius=" + radius + "Area : " + getArea() + "Circuference : " + getCircuference() + "Center : " + getCenter(); }

}

/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Task1;

/** * * @author tm2 */ public class Point {

private int x; private int y;

public Point() { x = 0; y = 0; }

/** * * @param x * @param y */ public Point(int x, int y) { this.x = x; this.y = y; }

/** * * @return */ public int getX() { return x; }

/** * * @param x */ public void setX(int x) { this.x = x;

}

/** * * @return */ public int getY() { return y;

}

/** * * @param y */ public void setY(int y) { this.y = y;

}

/** * * @param x * @param y */ public void setXY(int x, int y) {

this.x = x;

this.y = y;

}

/** * * @return */ @Override public String toString() {

return "(" + this.x + ", " + this.y + ")";

}

/** * * @param x * @param y * @return */ public double distance(int x, int y) {

int xDX = this.x - x;

int yDX = this.y - y;

return Math.sqrt((xDX * xDX) + (yDX * yDX));

}

public double distance(Point another) {

return distance(another.getX(), another.getY());

}

}

/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Task1;

/** * * @author tm2 */ public abstract class Shape { public abstract double getArea(); public abstract double getCircuference(); public abstract Point getCenter(); }

/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Task1;

//import java.util.Scanner; /** * * @author tm2 */ public class Tester {

/** * * @param args */ public static void main(String[] args) { Point p1 = new Point(3, 4); Point p2 = new Point(8, 6); Point p3 = new Point(4, 9); Circle C1 = new Circle(1, 2, 3); Circle C2 = new Circle(p1, 5); Triangle v1 = new Triangle(p1, p2, p3); Triangle t = new Triangle(1, 2, 3, 4, 5, 6); Rectangle u = new Rectangle(-1, -2, -3, -7); Square Q = new Square(5, 6, 9, 7); System.out.println(" ***************** "); System.out.println(" Point class : "); System.out.println(" ***************** " ); System.out.println(p1.toString()); System.out.println(p2.toString()); System.out.println(p3.toString()); System.out.println(" ***************** "); System.out.println(" Circle class : "); System.out.println(" ***************** "); System.out.println(C1.toString()); System.out.println(C2.toString()); System.out.println(" ***************** "); System.out.println(" Triangle class : "); System.out.println(" ***************** "); System.out.println(v1.toString()); System.out.println(t.toString()); System.out.println(" ***************** "); System.out.println("Rectangle class : "); System.out.println(" ***************** "); System.out.println(u.toString()); System.out.println(" ***************** "); System.out.println(" Squara class : "); System.out.println(" ***************** "); System.out.println(Q.toString());

} }

i need you make junit test class

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!