Write a generic
drawRowmethod having this heading:
private void drawRow(int startCol, int endCol)
startColand
endColare the column numbers of the left and right borders, respectively. Then modify the
Squareclass’s
drawmethod in Figure to draw either a solid square or a solid triangle whose height and width equal the width of the input width of a square container. What about the area now? Is it a redundant value, or is it a legitimate object attribute? Modify the instance variables and the
getAreamethod accordingly. Then drive your modified
Squareclass (call it
Square2) with a
Square2Driverwhose main method looks like this:
public static void main(String[] args){ Scanner stdIn = new Scanner(System.in); Square2 square; System.out.print("Enter width of square container: "); square = new Square2(stdIn.nextInt()); square.draw(); System.out.println("Area = " + square.getArea());} // end mainSample session:Enter width of square container: 5print (s)quare or (t)riangle? t***************Area = 15Figure Square class: first-cut version–part A

We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.