Question: Section 3, P 9. (15 marks) Write a program (without imports) that prompts the user to enter a double value. This double represents the length

 Section 3, P 9. (15 marks) Write a program (without imports)

Section 3, P 9. (15 marks) Write a program (without imports) that prompts the user to enter a double value. This double represents the length of a side of a cube. The program has a method to compute and return the surface area of a cube (6 x side length x side length), another method to compute and return the volume (side length x side length x side length) and a mairn method to do the rest of the work (prompt the user, call the methods, display the results). Your arca and volumc methods should throw an exception if the argument (side length) is negative - this is an illegal argument. Your main method should catch this exception and any number format exception if the user tries to enter a String when prompted for the side length. The program should continue (prompt, compute, display) until the user enters a side length of O which ends the program *Alternate: Ignore the exceptions above for a maximum of 9 out of 15

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!