Question: Go through the code below. Find IF ANY OO design principles are violated and explain your answer. If you find a violation, how will you
Go through the code below. Find IF ANY OO design principles are violated and explain your answer. If you find a violation, how will you refactor the code to solve the violation
public class Shapeprotected double side;protected double side;public Shapedouble side double sidethisside side;thisside side;public void setsidedouble sthisside s;public void setsidedouble sthisside s;public double calculateAreareturn sideside;public class Shape extends Shapepublic Shapedouble ssupers s;public void setsidedouble sthisside s;thisside s;public void setsidedouble sthisside s;thisside s;public class Testpublic static void mainString args throws ExceptionShape shp new Shape;shpsetside;shpsetside;Systemout.printlnshpcalculateArea;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
