Beginner Java Help

CBSwagga

All Star
Joined
Jan 16, 2017
Messages
1,239
Reputation
208
Daps
3,963
Wanted to see if anyone could help guide me through the thinking on this question
Having written the methods to calculate areas of a square and a triangle, write a method named calcShapeArea that takes two values as x and y shown in the diagram above, and invokes calcSquareArea(x) and calcTriangleArea(x, y) to compute the area of the shape. Your expression should call the methods calcSquareArea and calcTriangleArea.

Code:
public double calcShapeArea(int x, int y) {
    //Write code here
}

//There's no need to modify calcSquareArea or calcTriangleArea
public double calcSquareArea(int side) {
    return side * side;
}

public double calcTriangleArea(int base, int height) {
    return 0.5 * base * height;
}
 

CBSwagga

All Star
Joined
Jan 16, 2017
Messages
1,239
Reputation
208
Daps
3,963
That's a confusing ass question lol
appreciate you taking a look. I noticed after hours of looking that the submission box under the IDE used for this program started taking anything as correct. All that time for a broken program smh. Glad I ain't the only one found it confusing.
 

hatealot

Banned
Joined
Jan 22, 2017
Messages
13,656
Reputation
2,340
Daps
51,228
appreciate you taking a look. I noticed after hours of looking that the submission box under the IDE used for this program started taking anything as correct. All that time for a broken program smh. Glad I ain't the only one found it confusing.
Did you actually get the right answer ?
 
Top