DOC PREVIEW
UT Arlington CSE 3302 - Smalltalk

This preview shows page 1-2-3-4 out of 11 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CSE 3302 Programming LanguagesCorrection of example in lecture 15HW3An ExampleSlide 5Slide 6Slide 7Slide 8Slide 9Slide 10Slide 11CSE 3302 Programming LanguagesChengkai LiSpring 2008Smalltalk(cont.)Lecture 16 – OO Programming, Spring 20081CSE3302 Programming Languages, UT-Arlington ©Chengkai Li, 2008Correction of example in lecture 15A>>m2….A subclass: #B … (not “B subclass: #A …”)B>>m2super m2B subclass: #C…C>>m1self m2aC := C new.aC m1What will happen if the lookup of m2 starts from the superclass of message receiver?Lecture 16 – OO Programming, Spring 2008CSE3302 Programming Languages, UT-Arlington ©Chengkai Li, 20082HW3Array:•reverse•maxLecture 16 – OO Programming, Spring 2008CSE3302 Programming Languages, UT-Arlington ©Chengkai Li, 20083An ExampleA library has books and clients. •Client: an ID, a name, an address and a collection of the books checked out. •Book: an ID, a title, an author, and a current state, which is either “checked out“ or “on shelf”.•Library: a collection of customers and a collection of books that are not checked out.Lecture 16 – OO Programming, Spring 2008CSE3302 Programming Languages, UT-Arlington ©Chengkai Li, 20084•Define three classes Library, Book, and Client. Lecture 16 – OO Programming, Spring 2008CSE3302 Programming Languages, UT-Arlington ©Chengkai Li, 20085•Define the initialization methods for these three classes.Lecture 16 – OO Programming, Spring 2008CSE3302 Programming Languages, UT-Arlington ©Chengkai Li, 20086•Define an allBooksDo: method for Library that iterates over both the books that are checked out and the books that are not checked out.Lecture 16 – OO Programming, Spring 2008CSE3302 Programming Languages, UT-Arlington ©Chengkai Li, 20087•Define a booksTitled: method for Library that returns a collection of all books with a particular title.Lecture 16 – OO Programming, Spring 2008CSE3302 Programming Languages, UT-Arlington ©Chengkai Li, 20088•Define the checkOut: method for Client, which takes a book as an argument and assigns to to the client.Lecture 16 – OO Programming, Spring 2008CSE3302 Programming Languages, UT-Arlington ©Chengkai Li, 20089•Define the checkoutBy: method for Book, which is only called if the book is not checked out. Its argument is the client checking out the book.Lecture 16 – OO Programming, Spring 2008CSE3302 Programming Languages, UT-Arlington ©Chengkai Li, 200810•Define the customer:checksOut: method for Library, which takes a client and a book and records the fact that the client checks out the book. It should check that the book is free before letting the client to check out.Lecture 16 – OO Programming, Spring 2008CSE3302 Programming Languages, UT-Arlington ©Chengkai Li,


View Full Document

UT Arlington CSE 3302 - Smalltalk

Documents in this Course
Syntax

Syntax

5 pages

Syntax

Syntax

5 pages

JAVA

JAVA

57 pages

Semantics

Semantics

41 pages

Control

Control

74 pages

Load more
Download Smalltalk
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Smalltalk and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Smalltalk 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?