Question: For the Square class in Figure 8.13a, rewrite the Square constructor and the getArea method so that theres no this prefix. Figure 8.13a: /******** *

For the Square class in Figure 8.13a, rewrite the Square constructor and the getArea method so that there’s no this prefix.

  • Figure 8.13a:

/******** * Square.java Dean & Dean * *This class manages squares. ************** import java.util. Scanner;

/******** * Square.java Dean & Dean * *This class manages squares. ************** import java.util. Scanner; public class Square. { private int width; //********** public Square (int width) ( } this.width = width; public double getArea() { } return this.width * this.width; //****************** public void draw() { drawBorder Square (); Scanner stdIn = new Scanner (System.in); } else { ******************* drawSolidSquare (); ***************************** System.out.print("Print with (b) order or (s)olid? "); if (stdIn.nextLine().charAt(0) == 'b') ( } 3 // end draw ******* ********************************

Step by Step Solution

3.55 Rating (152 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

In the code for the Square class provided in Figure 813a the this prefix is used to refer to the ins... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Introduction To Programming With Java A Problem Solving Approach Questions!