List of examples

Chapter 1  Chapter 2  Chapter 3  Chapter 4  Chapter 5  Chapter 6  Chapter 7 
Chapter 8  Chapter 9  Chapter 10  Chapter 11  Chapter 12  Chapter 13  Chapter 14  Chapter 15 

PART 1 Fundamentals 1

Chapter 1 Introduction

The Nature Conservation Project (Nature.html)

Chapter 2 Simple programs

2.1 Welcome (Welcome.java)
2.2 Olympic Rings (Rings.java)
2.3 Displaying a warning (DisplayWarning.java)
2.4 Calculating interest (InterestIncrease.java)
2.5 Fleet timetables (NewFleet.java)
2.6 Where am I? (WhereAmI.java)

Chapter 3 Structuring

3.1 Multiple labels (LotsaLabels.java)
3.2 Conversion table (TemperatureTable.java)
3.3 Campfire song (Mow.java)
3.4 A large conversion table (LargeTemperatureTable.java)
3.5 Financial modelling (GrowthPlan.java)
3.6 Labels with class (Labels.java, PrintLabels.java)
CS1 Price tickets (Tickets.java, PrintTickets.java)

Chapter 4 Changing the state

4.1 Greetings (Greetings.java)
4.2 Summing a sequence of numbers (Summation1.java)
4.3 Inputting from a file (Summation2.java)
4.4 Saving a label (SaveaLabel.java)
4.5 Summing three ways (Summation3.java)
4.6 The highest number (HighestValue.java)
4.7 Counterfeit cheques (Cheque.java)
4.8 Summation with exceptions (Summation4.java)
4.9 Olympic medals (Olympics.java, medals)
4.10 Secure file opener (Olympics2.java, FileMan.java)

Chapter 5 Controlling the flow

5.1 Highest common factor (FindHCF.java)
5.2 Exchange rates (ForeignExchange.java)
5.3 Controlling an engine (Controller.java)
5.4 Missing the target (Exceptions.java)
5.5 Testing a dates class (TestDate.java, Dates.java)
CS2 Rock-scissors-paper game (PlayGame.java, RSPGame.java)

Chapter 6 Arrays and tables

6.1 Frequency count (Frequencies.java)
6.2 Diving competitions (Judge.java, Diving.java)
6.3 Gold exploration (Gold.java, Explore.java, mali.dat)
6.4 Rainfall statistics (Rain.java, rain.dat, Weather.java)
6.5 Sorting words in a file (SortWords.java)
6.6 Student marker (Students.java, Marker.java, marks.dat)

Chapter 7 Formatting

7.1 Removing double spaces (Spaces.java)
7.2 The Text class (Text.java)
7.3 Currency conversion table (Currency.java, rates.dat, rates.out)
7.4 Shopping days (Shopping.java)
7.5 Formatting and parsing dates (CustomDates.java)
7.6 Testing time zones (WorldTime.java)
7.7 Multilingual dates (VaryDates.java)

PART II Power 1

Chapter 8 Objects at work

8.1 Exploring protection (E.java)
8.2 Nelson’s Coffee Shop (Batch.java, Coffee.java, CoffeeShop.java, coffee.dat, orders.dat)
8.3 A class for lists (List.java)
CS3 Nelson's Coffee Shop (Batch.java, Coffee.java, CoffeeShop.java, coffee.dat, orders.dat)

Chapter 9 Abstraction and inheritance

9.1 Sorting anything (Table.java, TableInt.java, Country.java, Sort.java, Sortable.java)
CS4 Veterinary tags (Tags.java, XTags.java, Vet2.java, vet2.dat)

Chapter 10 Graphical user interfaces

10.1 Virus warning using graphics (GraphicWarning.java)
10.2 A weather chart (WeatherChart.java, rain.dat)
10.3 Warning with two responses (ButtonTest.java)
10.4 Traffic lights (Traffic0.java)

Chapter 11 Event-driven programming

11.1 New traffic lights display (Traffic1.java)
11.2 Traffic light calibration (Traffic1.java)
CS5 Supermarket till (Till.java)

Chapter 12 Applets in action

12.1 Virus warning applet (WarningApplet.java)
12.2 Supermarket till applet (TillApplet.java)
12.3 The newspaper competition (Competition.java)
12.4 Catching the duke (CatchM.java)
CS6 The Nature Conservation Project (TreesAp.java)

HTML

12.1 Virus warning applet (WarningApplet.html)
12.2 Supermarket till applet (Till.html)
12.3 The newspaper competition (Competition.html)
12.4 Catching the duke (CatchM.html)
CS6 The Nature Conservation Project (Nature.html)

Chapter 13 Multi-threading

13.1 Traffic lights flashing (Traffic2.java)
13.2 Traffic lights for walking (Traffic3.java)
13.3 Car-parks for a viewpoint (CarPark.java)
CS7 Walkman hire (WalkmanHire.java, Museum.java, Visitors.java)

Chapter 14 Networking

14.1 Listing a file (Lister.java)
14.2 Fetching an image (FetchImage.java)
14.3 Opening a port (Ports.java)
14.4 Creating an ATM server (ATMServer.java)
CS8 Chatter System (ChatServer.java)
14.5 Animals on a database (Animals.java)
14.6 RMI illustration (ActualThing.java, ThingClient.java, ThingServer.java)

CS9 Airport Announcements System (README)

  • AirportMessage.java, AirportMessageClient.java, AirportMessageServer.java
  • Announcer.java, AnnouncerClient.java, AnnouncerServer.java
  • Checkin.java, Monitor.java
  • Checkin.html, checkin.html source
  • Applets.html, Applets.html source
  • index.html, index.html source
  • Contents.html, Contents.html source

  • Chapter 15 Algorithms and data structures

    15.1 Animated binary search (Animated.java)
    15.2 Reversing a sentence (Reverser.java)
    15.3 Doctor’s waiting room (WaitingRoom.java, Queue.java, QueueException.java)
    15.4 Photograph line-up (Photo.java, Comparable.java, DLNode.java, DLList.java, Student.java, students.dat)
    15.5 Training schedules (Training.java)