6.11.0.4

Week 3 Set b

home work!

Programming Language BSL

Due Date Wed at 9:00pm (Week 3)

Purpose practice program design, especially the design of event-handling functions

Finger Exercises

Exercise 1 From HtDP, based on Week 2 Set b, 102.

Exercise 2 Design the program echo. Its main function consumes a single String and then connects to the dictionary server of the College. Like the program demonstrated in lecture, echo receives a word from the server and sends one back. The word that it sends back is the one that it received one message ago. For the first one, it sends back the given String.

The program displays the most recently arrived word.

Note You can copy the program from your lecture notes and play until "it works". But this is not how program design works. You are better off working through the program design recipe
  • to identify the big-bang clauses you need;

  • to create a wish list of functions (signatures, purpose statements, headers); and

  • to work through the design of each of these functions.

That way you properly prepare the graded part of this homework set.

Graded Exercises

Exercise 3 From HtDP, 108.

Exercise 4 Design the program timed-echo. Its main function consumes a String and a counting Number. It then connects to the dictionary server of the College. Like the program demonstrated in lecture, echo time-echo receives a word from the server and sends one back. The word that it sends back is the one that it received one message ago. For the first one, it sends back the given String. The program shuts down after it has received as many messages as the given counting Number specifies.

The timed-echo program displays the most recently received word.

Note A counting Number is either 0 or 1 or 2 or 3 or ... If the dots disturb you, you are on to a critical idea.