I have a class named Rectangle.The class has two properties width and height. I need to check whether the Rectangle class has golden ratio(height/width = 1.6), if it does I need to return true, else return false.
Here is my class:
class Rectangle {
private int x, y;
private int height, width;
public boolean isGoldenRatio()
{
return (height / width == 1 && height % width == 6);
}
}
I created the function isGoldenRatio() to check the ratio of the sides. But I guess it's wrong, because I don't get the desired result.
UPDATE: I cant define additions fields in my class and I cant use math library.
Any idea how to fix the function?