副标题:无

作   者:

分类号:

ISBN:9780321245748

微信扫一扫,移动浏览光盘

简介

"This principle-driven introduction to programming with Java and its standard Swing graphics library by world-renowned computer science professor Andy van Dam and professor Kate Sanders emphasizes object-oriented design and programming. It covers all important object-oriented programming mechanisms at the beginning of the book - from encapsulation through inheritance, interfaces, and polymorphism. It uses numerous executable examples to teach modularization and other good programming habits that will stay with students for a lifetime. Most of the programming examples and exercises take advantage of the visual appeal of interactive graphics to provide essential motivation for first-time programmers."--BOOK JACKET.

目录

Table Of Contents:
Preface vii

Background 1(16)

Introduction 1(1)

Computer hardware 1(1)

Computer software 1(2)

Programming languages and Java 3(1)

Executing a program 4(2)

Software tools for programming 6(2)

How compilation works in Java 8(1)

The process of writing programs 9(3)

What if your program doesn't work? 12(5)

Summary 13(1)

Self-Check Questions 14(1)

Exercises 14(3)

Introduction to Objects 17(38)

Introduction 17(1)

Concepts 18(7)

What is a model? 18(1)

How are models built? 19(2)

How to have different objects of the same type: classes and instances 21(1)

Managing complexity 22(1)

What makes a good software model? 23(2)

Mechanics 25(14)

The rubber stamp: declaring and defining a class 25(3)

Modeling properties: instance variables 28(3)

Modeling capabilities I: constructors 31(1)

Giving properties their values: assignment statements 32(2)

Modeling capabilities II: more about methods 34(3)

UML diagrams 37(2)

Working Out with Objects---getting started with Java 39(16)

Getting started 39(1)

Background: the Wheels library of graphical shapes 40(2)

Analysis 42(1)

Design 42(1)

Implementation 43(1)

Steps of execution 44(1)

Testing 45(1)

Followup 45(1)

Summary 45(1)

Self-Check Questions 46(2)

Exercises 48(4)

Programming Projects 52(1)

New Style Conventions 52(3)

Methods with Parameters 55(44)

Introduction 55(1)

Concepts 56(3)

Parameters 56(2)

Return values 58(1)

Mechanics 59(10)

Parameters 59(2)

Constructors with parameters 61(2)

Debugging tips for method calls 63(1)

Parameters, local variables, and instance variables 64(3)

Return types 67(1)

Method signatures and overloading 68(1)

Working Out with Objects---the talking sun 69(10)

Background: more about Wheels 70(1)

Analysis 70(2)

Design 72(1)

Implementation: version 1 73(1)

Imports, packages, and libraries 73(2)

Version 2: adding the constructor body 75(1)

Java's built-in colors 75(1)

Testing version 2 75(1)

Putting shapes in different locations in the Frame 76(1)

Implementation: version 3 77(2)

Testing version 3 79(1)

Working Out with Composite Objects---the snowman 79(20)

Analysis 79(1)

Design 80(1)

Implementation: reusing the SunCartoon 80(1)

Testing: the first piece of the program 81(1)

Implementation: the Hat 81(1)

Testing the Hat: part 1 81(1)

Setting the location of a composite object: the Hat 82(4)

Testing the Hat (continued) 86(1)

Pulling it all together: implementing the Snowman 87(1)

Testing the Snowman: part 1 88(1)

Implementing the Snowman (continued) 88(1)

Testing the Snowman (continued) 89(1)

Summary 90(1)

Self-Check Questions 90(1)

Exercises 91(2)

Programming Projects 93(6)

Inheritance 99(28)

Introduction 99(1)

Concepts 100(2)

Mechanics 102(11)

Simple inheritance 102(2)

Overriding inherited methods 104(3)

Implementing abstract methods 107(1)

Inheriting properties: pseudo-inheritance 108(3)

Method resolution 111(2)

Working Out with Inheritance---the Blobs 113(14)

Background: mouse methods in Wheels 113(1)

Analysis 114(1)

Design 115(1)

Implementation: BlobApp with one Blob 116(1)

Testing (part 1) 117(1)

Implementation: a BlobApp with a WinkingBlob 117(2)

Testing (part 2) 119(1)

Implementation: a BlobApp with a WinkingBlob and a Talkative Blob 120(1)

Final Testing 120(1)

Summary 121(1)

Self-Check Questions 121(1)

Exercises 122(3)

Programming Projects 125(2)

Interfaces 127(30)

Introduction 127(1)

Concepts 128(1)

Mechanics 129(7)

Defining and implementing interfaces 129(1)

Classes that implement multiple interfaces 130(3)

Extending interfaces 133(1)

Design choices: interfaces vs. abstract classes 134(1)

Design choices: how many interfaces to use 135(1)

Design choices: which capabilities to put in which interface 135(1)

Working Out with Interfaces---a movable sun 136(5)

Writing an interface 136(2)

Writing a class that implements an interface 138(1)

Implementing the mouseDragged method 138(2)

Implementing the Frame: MovableSunApp 140(1)

Working Out with Interfaces and Composite Shapes---a movable hat 141(5)

Getting started: the interface and the movableHatApp 142(1)

Creating a part that knows about its container: the HatPart class 143(1)

Creating a composite object that moves as a unit: the Hat class 144(2)

Recipes 146(11)

Defining classes 147(1)

Initializing instance variables 147(1)

Instance variables with default values 148(1)

Accessors and mutators 149(2)

Parts that know about their containers 151(2)

Summary 153(1)

Self-Check Questions 153(1)

Exercises 154(1)

Programming Projects 155(2)

Polymorphism 157(26)

Introduction 157(1)

Concepts 158(3)

Mechanics 161(5)

Inheritance polymorphism 161(2)

Interface polymorphism 163(1)

Determining which method is invoked 164(2)

Working Out with Polymorphism---the sketch pad 166(17)

Analysis 166(1)

Design 167(1)

Implementation 168(3)

Testing 171(2)

Summary 173(1)

Self-Check Questions 174(1)

Exercises 175(5)

Programming Projects 180(3)

Introduction to Arithmetic and Conditional Statements 183(28)

Introduction 183(1)

Concepts 184(8)

Representing numbers 184(1)

Arithmetic operators 184(1)

Conditional statements and Boolean logic 185(3)

Relational operators 188(1)

Object equality 188(1)

Choosing when you have one yes-no alternative 189(1)

Choosing from two different alternatives 189(1)

Choosing from many alternatives 190(1)

When to use conditional statements 191(1)

Mechanics 192(8)

Numbers in Java 192(2)

Arithmetic operators 194(1)

Increment and decrement 195(1)

Boolean operators 196(1)

Relational operators 197(1)

Single decisions 198(2)

Working Out with Arithmetic and Conditionals---Daisy, Daisy, give me your answer do 200(11)

Summary 206(1)

Self-Check Questions 206(1)

Exercises 207(3)

Programming Projects 210(1)

Two-Dimensional Graphical Shapes 211(48)

Introduction 211(1)

Concepts 212(1)

Working Out with Windows and Shapes---FirstApp revisited 213(12)

JFrames 213(2)

JPanels 215(2)

Layout 217(1)

Putting an ellipse in a JPanel 218(1)

Creating a ``smart'' ellipse 218(3)

Drawing shapes and the Graphics object 221(4)

Working Out with Events and Animation---the bouncing ball 225(11)

The Java event model 225(5)

Using events: making the ballApp bounce 230(4)

Rotating shapes 234(2)

Working Out with Events and Composite Shapes---the fish tank 236(10)

Working Out with Design---building our own Wheels 246(13)

Java's built-n shape classes 246(1)

Our new ColorShape classes 247(5)

Summary 252(1)

Self-Check Questions 253(1)

Exercises 253(2)

Programming Projects 255(4)

Graphical User Interfaces and Event-Handling 259(42)

Introduction 259(2)

Concepts 261(5)

Design principles 261(3)

Design tools 264(2)

Mechanics 266(16)

Arranging components on the screen: layouts 266(4)

Components 270(6)

Making the program respond to input: event handling and SmartComponents 276(6)

Working Out with GUI---a user-controlled bouncing ball 282(19)

Part 1: layout 283(2)

The ControlPanel 285(1)

The QuitButton 286(1)

Adding the BallPanel with the BouncingBall, adding the color buttons, and making them work 287(2)

Adding sliders 289(6)

Summary 295(1)

Self-Check Questions 295(2)

Exercises 297(2)

Programming Projects 299(2)

Design Patterns 301(34)

Introduction 301(1)

Concepts 302(1)

Mechanics 303(1)

Working Out with the Holder Pattern---part of a drawing program 303(8)

Modeling the current color: the Holder Pattern 305(1)

ColorHolderApp 306(1)

The ControlPanel class and the button classes 307(1)

ColorShapePanel 308(3)

Working Out with the Proxy Pattern---race cars 311(16)

Working Out with the Composite Pattern---the space alien 327(8)

Summary 332(1)

Self-Check Questions 333(1)

Exercises 333(1)

Programming Projects 333(2)

Advanced Arithmetic and Conditional Statements 335(30)

Introduction 335(1)

Concepts 336(3)

Modeling real numbers 336(1)

Operations on floating-point numbers 336(1)

Casting and coercion 336(1)

Modeling choices within choices 337(2)

Mechanics 339(14)

Floating-point numbers in Java 339(1)

Arithmetic operations on floating-point numbers, casting, and coercions 340(2)

Java's Math class: static variables and methods 342(1)

Random numbers 343(1)

Constants: how, where, and when to define them 344(3)

Modeling choices within choices: nested conditionals 347(2)

Short-circuiting 349(1)

Switch statement 350(3)

Working Out with floating point numbers, nested conditionals, and random numbers---ColorBounceApp 353(12)

Summary 359(1)

Self-Check Questions 359(1)

Exercises 360(2)

Programming Projects 362(3)

Loops 365(32)

Introduction 365(1)

Concepts 366(1)

Mechanics 366(20)

Vectors 366(4)

Indefinite loops: while loops 370(3)

Iterators 373(1)

Indefinite loops: do--while 374(1)

Definite loops: the for loop 374(3)

Break and continue in loops 377(1)

Choosing between loops 378(1)

Recipes for writing loops 379(2)

Debugging loops 381(3)

Flow of control 384(2)

Working Out with Loops---ButterflyApp 386(11)

Summary 392(1)

Self-Check Questions 393(1)

Exercises 393(2)

Programming Projects 395(2)

Recursion 397(24)

Introduction 397(1)

Concepts 398(1)

Mechanics 399(8)

An example with one recursive call: factorial 399(2)

An example with more than one recursive call: Towers of Hanoi 401(3)

Debugging tips 404(1)

Choosing between iteration and recursion 404(3)

Working Out with Recursion---SpiralApp 407(6)

Working Out with Recursion--TreeApp 413(8)

Summary 418(1)

Self-Check Questions 418(1)

Exercises 418(1)

Programming Projects 419(2)

Arrays, Vectors, and ArrayLists 421(20)

Introduction 421(1)

Concepts 421(1)

Mechanics 422(9)

Declaring and initializing arrays, ArrayLists, and Vectors 422(2)

Accessing and using elements 424(1)

Passing as parameters 425(1)

Multidimensional structures 425(2)

Debugging tips: common array errors 427(2)

Comparing and contrasting arrays, Vectors, and ArrayLists 429(1)

The mainline revealed 429(2)

Working Out with Arrays---ClickApp 431(10)

Summary 436(1)

Self-Check Questions 436(1)

Exercises 436(2)

Programming Projects 438(3)

Introduction to Data Structures 441(38)

Introduction 441(1)

Concepts 442(6)

Stacks 443(1)

Queues 444(1)

Lists 444(2)

Dictionaries 446(1)

Implementing ADTs with linked lists 446(1)

Instance diagrams 447(1)

Mechanics 448(23)

The Node class 449(2)

A StackADT interface 451(1)

The Stack class 451(3)

A QueueADT interface 454(1)

The Queue class 454(3)

A ListADT interface 457(1)

Implementing List and the Iterator design pattern 457(1)

A DictionaryADT interface 458(4)

The Dictionary class 462(9)

Working Out with Data Structures---Driver programs 471(8)

Summary 473(1)

Self-Check Questions 474(1)

Exercises 475(2)

Programming Projects 477(2)

Trees 479(26)

Introduction 479(1)

Concepts 480(10)

Modeling with trees 480(3)

Implementing dictionary operations efficiently with trees 483(3)

In-order, pre-order, post-order 486(4)

Mechanics: Binary Search Trees 490(10)

Declaring the BinarySearchTree class 491(9)

Working Out with Trees---Driver Program 500(5)

Summary 502(1)

Self-Check Questions 502(1)

Exercises 502(3)

Sorting and Searching 505(28)

Introduction 505(1)

Concepts 506(27)

Sorting: overview 508(1)

Bubble sort 509(4)

Insertion sort 513(3)

Selection sort 516(1)

Merge sort 517(1)

Recurrence relations 518(4)

Searching: overview 522(1)

Searching: arrays 523(1)

Searching: linked lists 524(1)

Searching: binary trees 524(1)

Searching: n-ary and hybrid trees 525(2)

Searching: hash tables 527(3)

Summary 530(1)

Self-Check Questions 530(1)

Exercises 531(1)

Programming Projects 532(1)

Strings and Text I/O 533(22)

Introduction 533(1)

Concepts 533(1)

Mechanics: Strings 534(6)

Combining Strings 535(1)

Extracting parts of Strings 536(1)

Comparing Strings 536(1)

Reversing Strings 537(2)

Summarizing the String class 539(1)

Working Out with Strings---GUI Text I/O 540(15)

A boilerplate GUI for simple text I/O programs 540(5)

A simple program: EchoApp 545(1)

A second application: StringMethodsApp 546(1)

A third application: EqualTestApp 546(5)

Summary 551(1)

Self-Check Questions 551(1)

Exercises 551(1)

Programming Projects 552(3)

Console I/O, File I/O, and Exceptions 555(30)

Introduction 555(1)

Concepts 556(6)

Console I/O 556(1)

File I/O 557(2)

Saving objects to files and reading them back in 559(1)

Exceptions 559(3)

Mechanics 562(17)

Console I/O 562(7)

Exceptions 569(7)

File I/O 576(3)

Working Out with File I/O---Saving and restoring objects 579(6)

Summary 583(1)

Self-Check Questions 583(1)

Exercises 584(1)

Programming Projects 584(1)
Index 585

已确认勘误

次印刷

页码 勘误内容 提交人 修订印次

    • 名称
    • 类型
    • 大小

    光盘服务联系方式: 020-38250260    客服QQ:4006604884

    意见反馈

    14:15

    关闭

    云图客服:

    尊敬的用户,您好!您有任何提议或者建议都可以在此提出来,我们会谦虚地接受任何意见。

    或者您是想咨询:

    用户发送的提问,这种方式就需要有位在线客服来回答用户的问题,这种 就属于对话式的,问题是这种提问是否需要用户登录才能提问

    Video Player
    ×
    Audio Player
    ×
    pdf Player
    ×
    Current View

    看过该图书的还喜欢

    some pictures

    解忧杂货店

    东野圭吾 (作者), 李盈春 (译者)

    亲爱的云图用户,
    光盘内的文件都可以直接点击浏览哦

    无需下载,在线查阅资料!

    loading icon