Use the exception class MessageTooLongException of Self-Test Question 16 in a program that asks the user to enter a line of text having no more than 20 characters. If the user enters an acceptable number of characters, the program should display the message, “You entered x characters, which is an acceptable length” (with the letter x replaced by the actual number of characters). Otherwise, a MessageTooLongException should be thrown and caught. In either case, the program should repeatedly ask whether the user wants to enter another line or quit the program.

This project has exactly the same organization as ExceptionDemo, Listing 9.2


See the code in MessageTooLongException.java and MessageTooLongExceptionDemo.java.

Computer Science & Information Technology

You might also like to view...

Match each item with the correct statement below.

A. An out-of-control Ethernet transmitter generating a frame that is longer than 1526 bytes B. A 32-bit pattern generated by stations detecting a collision and designed to propagate the collision throughout the network C. Any transmitted frame whose length is less than the minimum frame size, even a short frame with a valid FCS D. The maximum frame size allowed on the network. E. A portion of a LAN (or the entire LAN) where two or more stations transmitting at the same time will interfere with each other

Computer Science & Information Technology

The first step in planning a data exchange is to set up the data exchange.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Explain how SCADA differs from DCS.

What will be an ideal response?

Computer Science & Information Technology

When you extract an object from a layer, Photoshop deletes the extracted part of the image down to the underlying transparency.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology