What is wrong in these lines in the following code? Making reference to the line numbers below, briefly indicate the pro

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

What is wrong in these lines in the following code? Making reference to the line numbers below, briefly indicate the pro

Post by answerhappygod »

What is wrong in these lines in the following code? Makingreference to the line numbers below, briefly indicate the problemand suggest the fix, otherwise mark as "no error".
Line 5:Line 20:Line 21:Line 22:1 public class Circle { 2 private double radius; 3 4 public Circle(double radius) { 5 radius = radius; 6 } 7 8 public double getRadius() { 9 return radius;10 }1112 public double getArea() {13 return radius * radius * Math.PI;14 }15 }1617 class B extends Circle {18 private double length;1920 B(double radius, double length) {21 Circle(radius);22 length = length;23 }24
2526 public double getArea() {27 return getArea() * length;28 }29 }
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply