I am having a frustrating time partway through a Java assignment. I have the first part completed, which is to:
"Create a class named Rectangle to represent a rectangle. The class contains:
• Two double data fields named width and height that specify the width and height of the rectangle.
• A no-arg constructor that creates a default rectangle with 1 for both width and height.
• A constructor that creates a rectangle with a specified width and height.
• public accessor methods for each property
• A method named getArea() that returns the area of the rectangle.
• A method named getPerimeter() that returns the perimeter."
However, I can't seem to finish the next one, which states:
"Write a static method in your Rectangle class called makeGoldenRectangle that takes as a parameter a double representing the longer side of the rectangle and returns a newly constructed Rectangle that is a golden rectangle (http://en.wikipedia.org/wiki/Golden_ratio). The returned rectangle should have height=the longer side and width=the shorter side."
I have the calculation part of the code, I just can't figure out how to get it to return a "rectangle" object, which is critical for the next part. Does anyone have advice or resources I consult (I'm a novice, so resources that can explain things to a potato if possible).
new Rectangle()and supply the width and height.