package myprojects.compareobjects;
public class Room {
private double width;
private double depth;
public void setSize(double width, double depth) {
this.width = width;
this.depth = depth;
System.out.println("Setting the size of room to "+width+" "+depth);
}
public boolean compareSize(Room roomIn) {
if((roomIn.getWidth()*roomIn.getDepth()) == width*depth) {
// the same size, return true
return true;
} else {
// Not the same size, return false
return false;
}
}
public double getWidth() {
// Accessor method to return the width
return width;
}
public double getDepth() {
// ditto for the depth
return depth;
}
}
|