Exercises


[Page 765]

Note

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


Exercise 15.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.

Exercise 15.2

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

Exercise 15.3

What service is managed by the HTTP protocol?

Exercise 15.4

Give examples of client applications that use the HTTP protocol.

Exercise 15.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.

Exercise 15.6

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

Exercise 15.7

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

Exercise 15.8

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

Exercise 15.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.

Exercise 15.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. Each time the button is clicked, the applet should download one of the message files.

Exercise 15.11

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

Exercise 15.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.)

Exercise 15.13

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.




Java, Java, Java(c) Object-Orienting Problem Solving
Java, Java, Java, Object-Oriented Problem Solving (3rd Edition)
ISBN: 0131474340
EAN: 2147483647
Year: 2005
Pages: 275

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net