68 473
Assignments Done
98,8%
Successfully Done
In December 2018

Answer to Question #47304 in Other Programming & Computer Science for Suzan

Question #47304
Consider the following implementation of a class Square:

public class Square
{
privateintsideLength;
privateint area; // Not a good idea

public Square(int length){
sideLength = length;
}
publicintgetArea(){
area = sideLength * sideLength;
return area;
}
}

Why is it not a good idea to introduce an instance variable for the area? Rewrite the class so that area is a local variable.
Expert's answer

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Suzan
29.09.14, 01:44

THANK YOU

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions