/home/caleb/ASDV-Java/Semester 2/Assignments/MP5_CalebFontenot/src/main/java/com/calebfontenot/mp5_calebfontenot/Rectangle.java |
nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java
package com.calebfontenot.mp5_calebfontenot;
public class Rectangle extends GeometricObject{
private double width;
private double height;
public Rectangle() {
}
public Rectangle(double width, double height) {
this.width = width;
this.height = height;
}
public double getWidth() {
return width;
}
public void setWidth(double width) {
this.width = width;
}
public double getHeight() {
return height;
}
public void setHeight(double height) {
this.height = height;
}
@Override
public double getArea() {
return width * height;
}
@Override
public double getPerimeter() {
return 2 * (width + height);
}
@Override
public int compareTo(GeometricObject t) {
System.out.println(this.getArea() + ", " + (t).getArea());
if (this.getArea() < (t).getArea()) {
return -1;
} else if (this.getArea() > (t).getArea()) {
return 1;
} else {
return 0;
}
}
@Override
public int compareTo(Object t) {
throw new UnsupportedOperationException("Not supported yet."); nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
}
}