DOC PREVIEW
UT Arlington CSE 3302 - Lecture Notes

This preview shows page 1 out of 2 pages.

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

Unformatted text preview:

3/22/20081CSE 3302 Programming LanguagesSmalltalk()Chengkai LiSpring 2008(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, 200863/22/20082• 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 tothe 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 bookthe 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 isfreebook. 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 - Lecture Notes

Documents in this Course
Smalltalk

Smalltalk

11 pages

Syntax

Syntax

5 pages

Syntax

Syntax

5 pages

JAVA

JAVA

57 pages

Semantics

Semantics

41 pages

Control

Control

74 pages

Load more
Download Lecture Notes
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 Lecture Notes 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 Lecture Notes 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?