Example: bankruptcy

Introduction to Programming Using Java - IIT Kanpur

Introduction to Programming Using JavaVersion , December 2006(Version , with minor corrections, November 2007)David J. EckHobart and William Smith Collegesiic 1996 2007, David J. EckDavid J. Eck of Mathematics and Computer ScienceHobart and William Smith CollegesGeneva, NY 14456 This book can be distributed in unmodified form with no versions can be made and distributed provided they are distributedunder the same license as the original. More specifically: This work islicensed under the Creative Commons Attribution-Share Alike view a copy of this license, visit or send a letter to Creative Commons, 543 Howard Street, 5thFloor, San Francisco, California, 94105, web site for this book is: The Mental Machine Language.

Introduction to Programming Using Java Version 5.0, December 2006 (Version 5.0.2, with minor corrections, November 2007) David J. Eck Hobart and William Smith Colleges

Tags:

  Java

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of Introduction to Programming Using Java - IIT Kanpur

1 Introduction to Programming Using JavaVersion , December 2006(Version , with minor corrections, November 2007)David J. EckHobart and William Smith Collegesiic 1996 2007, David J. EckDavid J. Eck of Mathematics and Computer ScienceHobart and William Smith CollegesGeneva, NY 14456 This book can be distributed in unmodified form with no versions can be made and distributed provided they are distributedunder the same license as the original. More specifically: This work islicensed under the Creative Commons Attribution-Share Alike view a copy of this license, visit or send a letter to Creative Commons, 543 Howard Street, 5thFloor, San Francisco, California, 94105, web site for this book is: The Mental Machine Language.

2 Asynchronous Events .. The java Virtual Machine .. Building Blocks of Programs .. Object-oriented Programming .. The Modern User Interface .. The Internet .. 14 Quiz on Chapter 1 .. 172 Names and The Basic java Application .. Variables and Types .. Variables .. Types and Literals .. Variables in Programs .. Objects and Subroutines .. Built-in Subroutines and Functions .. Operations on Strings .. Introduction to Enums .. Text Input and Output .. A First Text Input Example.

3 Text Output .. TextIO Input Functions .. Formatted Output .. Introduction to File I/O .. Details of Expressions .. Arithmetic Operators .. Increment and Decrement .. Relational Operators .. Boolean Operators .. Conditional Operator .. Assignment Operators and Type-Casts .. Type Conversion of Strings .. Precedence Rules .. Programming Environments .. java Development Kit .. Command Line Environment .. IDEs and Eclipse .. The Problem of Packages .. 56 Exercises for Chapter 2.

4 58 Quiz on Chapter 2 .. 603 Blocks, Loops, and Branches .. Blocks .. The Basic While Loop .. The Basic If Statement .. Algorithm Development .. Pseudocode and Stepwise Refinement .. The 3N+1 Problem .. Coding, Testing, Debugging .. while and .. The while Statement .. The Statement .. break and continue .. The for Statement .. For Loops .. Example: Counting Divisors .. Nested for Loops .. Enums and for-each Loops .. The if Statement .. The Dangling else Problem.

5 The if Construction .. If Statement Examples .. The Empty Statement .. The switch Statement .. The Basic switch Statement .. Menus and switch Statements .. Enums in switch Statements .. Definite Assignment .. Exceptions and .. Exceptions .. Exceptions in TextIO .. GUI Programming .. 104 Exercises for Chapter 3 .. 111 Quiz on Chapter 3 .. 1144 Black Boxes .. Static Subroutines and Variables .. Subroutine Definitions .. Calling Subroutines .. Subroutines in Programs.

6 Member Variables .. Parameters .. Using Parameters .. Formal and Actual Parameters .. Overloading .. Subroutine Examples .. Throwing Exceptions .. Global and Local Variables .. Return Values .. The return statement .. Function Examples .. 3N+1 Revisited .. APIs, Packages, and Javadoc .. Toolboxes .. java s Standard Packages .. Using Classes from Packages .. Javadoc .. More on Program Design .. Preconditions and Postconditions .. A Design Example .. The Program .. The Truth About Declarations.

7 Initialization in Declarations .. Named Constants .. Naming and Scope Rules ..158 Exercises for Chapter 4 .. 161 Quiz on Chapter 4 .. 1645 Objects and Objects and Instance Methods .. Objects, Classes, and Instances .. Fundamentals of Objects .. Getters and Setters .. Constructors and Object Initialization .. Initializing Instance Variables .. Constructors .. Garbage Collection .. Programming with Objects .. Some Built-in Classes .. Wrapper Classes and Autoboxing .. The class Object.

8 Object-oriented Analysis and Design .. Programming Example: Card, Hand, Deck .. Designing the classes .. The Card Class .. Example: A Simple Card Game .. Inheritance and Polymorphism .. Extending Existing Classes .. Inheritance and Class Hierarchy .. Example: Vehicles .. Polymorphism .. Abstract Classes .. this and super .. The Special Variable this .. The Special Variable super .. Constructors in Subclasses .. Interfaces, Nested Classes, and Other Details .. Interfaces.

9 Nested Classes .. Anonymous Inner Classes .. Mixing Static and Non-static .. Static Import .. Enums as Classes ..217 Exercises for Chapter 5 .. 220 Quiz on Chapter 5 .. 2236 Introduction to GUI The Basic GUI Application .. JFrame and JPanel .. Components and Layout .. Events and Listeners .. Applets and HTML .. JApplet .. Reusing Your JPanels .. Basic HTML .. Applets on Web Pages .. Graphics and Painting .. Coordinates .. Colors .. Fonts .. Shapes .. Graphics2D .. An Example.

10 Mouse Events .. Event Handling .. MouseEvent and MouseListener .. Mouse Coordinates .. MouseMotionListeners and Dragging .. Anonymous Event Handlers .. Timer and Keyboard Events .. Timers and Animation .. Keyboard Events .. Focus Events .. State Machines .. Basic Components .. JButton .. JLabel .. JCheckBox .. JTextField and JTextArea .. JComboBox .. JSlider .. Basic Layout .. Basic Layout Managers .. Borders .. SliderAndComboBoxDemo .. A Simple Calculator .. Using a null Layout.


Related search queries