Question: insert code in comments class LessThanZeroException extends Exception { / / define a parameterless construc XR 0 7 tor public LessThanZeroException ( ) { super

"insert code in comments
class LessThanZeroException extends Exception {//define a parameterless construc XR07 tor public LessThanZeroException(){ super(""this is an ArrayIndexOutOfBoundsException defined by users""); }
//define a constructor with a parameter which is a message provided by //users, and tells what exception has happened. public LessThanZeroException(String str){ super(str); }} class Q1_Class extends Shape_Abstract_Class { double r =-1.0; public void CalculateArea(){
/* Override the method CalculateArea() Add the missing code based on the comments below: It will perform the following operations: ask the user to input a double number representing the radius of a circle if the user's input is less than zero, it will throw a user-defined exception: LessThanZeroException the exception will be handled by a try...catch.otherwise, calculate the area of the circle. */}} public void Circumference(){
/* Override the method Circumference() Add the missing code based on the comments below: It will perform the following operations: ask the user to input a double number representing the radius of a circle. if the user's input is less than zero, it will throw a user-defined exception:
LessThanZeroException the exception will be handled by a try...catch otherwise, calculate the circumference of the circle. */} public void CalculateVolume(){/* Override the method CalculateVolume() Add the missing code based on the comments below: It will perform the following operations: ask the user to input a double number representing the radius of a ball if the user's input is less than zero, it will throw a user-defined exception: LessThanZeroException the exception will be handled by a try...catch otherwise, calculate the volume of the ball. */}} public class Q1_Test { public static void main(String[] args){ Q1_Class q1= new Q1_Class(); q1.CalculateArea(); q1.Circumference(); q1.CalculateVolume(); }}"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Programming Questions!