Question: Task 26: throws Exception. Aim: To declare exceptions in a method header and to throw exception in a method. Title: Circle, Test classes. Summary: Demonstrates

 Task 26: throws Exception. Aim: To declare exceptions in a method

Task 26: throws Exception. Aim: To declare exceptions in a method header and to throw exception in a method. Title: Circle, Test classes. Summary: Demonstrates declaring, throwing, and catching exceptions. Question: In this task, defines a class named Circle, as shown below, the setRadius (double new Radius) method throws an Exception if the argument new Radius is negative, this method throws the exception and doesn't catch itself, also write a test Java program that create an object of type Circle then test the setRadius....) method by asking the user to enter the value of the new radius. Your program should prompt the user to read the new radius again if the input is incorrect. Here is the class Circle: public class Circle private double radius; public Circle(double radius) { this.radius=radius; } public void setRadius(double newRadius) { radius=new Radius; ) }

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 Databases Questions!