Skip to main content

Section 15.13 Exercises

Note: For programming exercises, first draw a UML class diagram describing all classes and their inheritance relationships and/or associations.

  1. Explain the difference between each of the following pairs of terms:

    1. Stream and socket.

    2. Internet and internet.

    3. Domain name and port.

    4. Client and server.

    5. Ethernet and Internet.

    6. URL and domain name.

  2. What is a protocol? Give one or two examples of protocols that are used on the Internet.

  3. What service is managed by the HTTP protocol?

  4. Give examples of client applications that use the HTTP protocol.

  5. Why is it important that applets be limited in terms of their network and file system access? Describe the various networking restrictions that apply to Java applets.

  6. What does the Internet Protocol do? Describe how it would be used to join an ethernet and a token ring network.

  7. Describe one or two circumstances under which a ConnectException would be thrown.

  8. Modify the SlideShowFrame so that it plays an audio file along with each slide.

  9. Design and implement a Java applet that downloads a random substitution cryptogram and provides an interface that helps the user try to solve the cryptogram. The interface should enable the user to substitute an arbitrary letter for the letters in the cryptogram. The cryptogram files should be stored in the same directory as the applet itself.

  10. Design and implement a Java application that displays a random message (or a random joke) each time the user clicks a GetMessage button. The messages should be stored in a set of files in the same directory as the applet itself. Each time the button is clicked, the applet should download one of the message files.

  11. Write a client/server application of the message or joke service described in the previous exercise. Your implementation should extend the Server and Client classes.

  12. Write an implementation of the scramble service. Given a word, the scramble service will return a string containing all possible permutations of the letter combinations in the word. For example, given β€œman,” the scramble service will return β€œamn, anm, man, mna, nam, nma.” Use the Server and Client classes in your design. (See the Self-Study Exercises for a description of the design.) Challenge: Modify the Nim server game in this chapter so that the client and server can negotiate the rules of the game, including how many sticks, how many pick ups per turn, and who goes first.

You have attempted of activities on this page.