SDSU CS 535 Object-Oriented Programming
Fall Semester, 2003
Assignment 1
    Assignment Index        
© 2003, All Rights Reserved, SDSU & Roger Whitney
San Diego State University -- This page last updated 05-Sep-03

Assignment 1

Due Thursday September 11

1a. Read the Introduction lesson in the Lesson Runner to learn about VisualWorks home directory. To run the Lesson Runner in the “Help” menu of the launcher select the “Lesson Browser” item. What is your VisualWorks home directory?

1b. What directory is your version of VisualWorks using as the VisualWorks home?

1c. Open a System Browser and find the String class. Look at the method concreteIndexFor: in the accessing protocol. Now change the VisualWorks home setting so it is not correct. Then deselect and reselect the method concreteIndexFor: in the fourth list pane from the left in the System Browser. What happens? Now set the VisualWorks home to the correct value and deselect and reselect the method concreteIndexFor:. What happens?

2a. Which Launcher menu contains an item to allow you to find implementations of a method?

2b. Which class(es) implement the method raisedTo: ?

3a. Which Launcher menu contains an item to allow you to find the senders of a method?

3b. Which method(s) send the message useSmallPaletteAlgorithmFor: ?

4. Add the following method to the Character class in accessing category.

next
   ^(self asInteger + 1) asCharacter

What is printed when you evaluate the following expressions in a workspace using “Print It”?

   $a next 
   $z next
   'abc' collect: [:each | each next]

5. Exit VisualWorks and save the image as CS535. You should now have two images with different names: CS535.im and visualnc.im. Start VisualWorks with the image visualnc.im and search for the method next in the Character class. Can you find it? Exit VisualWorks and start VisualWorks with the image CS535.im and search for the method next in the Character class. Can you find it?

6. When you find the method next in the Character class file it out using the “File Out as...” item in the “Method” menu of the System Browser. Use the VisualWorks File Browser to open the file you just saved. What is the first line of the file?

7. Open the settings window by selecting the “Settings” item in the “System” menu of the Launcher. Select “Source in the tree view on the left. Change the file-out format to Smalltalk chunk source code. Now file out the method next in the Character class again. What is the first line of the file now?

Note source code printed out in XML Format is not accepted when turning in assignments.

8. Modify your Character>>next method so that:
   $z next returns $a
and
   $Z next returns $A

In all other cases the Character>>next method should return the same value as the one given in problem 4. Turn in your source code for the method.




Copyright ©, All rights reserved.
2003 SDSU & Roger Whitney, 5500 Campanile Drive, San Diego, CA 92182-7700 USA.
OpenContent license defines the copyright on this document.

    visitors since 02-Sep-03