Question: Source material: Object-Oriented Data Structures Using Java, 3rd Edition by Nell Dale. What is the answer to exercise 13 in chapter 3 (page 232)?? A.

Source material: Object-Oriented Data Structures Using Java, 3rd Edition by Nell Dale.

What is the answer to exercise 13 in chapter 3 (page 232)??

"A. Create a "standard" exception class called ThirteenException.

B. Write a program that repeatedly prompts the user to enter a string. After each string is entered the program outputs the length of the string, unless the length of the string is 13, in which case the ThirteenException is thrown with the message "Use thirteen letter words and stainless steel to protect yourself!" Your main method should simply throw the ThirteenException exception out of the runtime environment. At this point in the program bombs and the system provides some information, including the message.

c. Create another program similar to the one you just created, except this time, within your code, include a try-catch clause so that you catch the exception where it is thrown. If it is thrown, catch it, print it's message, and end the program normally."

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!