Skip to content

Instantly share code, notes, and snippets.

import org.junit.Test;
import static org.junit.Assert.*;
public class MovingObjectTest {
@Test
public void testDisplacement(){
MovingObject object = new MovingObject(10, 10, 10, 10);
assertEquals(600, object.displacement(), 0);
}
public class Square {
public int topLeftCoordinateX;
public int topLeftCoordinateY;
public int side;
}
public class AreaCalculator{
public double area(Object shape){
if (shape instanceof Square){
Square square = (Square) shape;
public interface Shape{
double area();
}
public class Square {
private int topLeftCoordinateX;
private int topLeftCoordinateY;
private int side;
public double area(){