Programming Fundamentals Using JAVA: A Game Application Approach, 2nd Edition
- Length: 775 pages
- Edition: 2
- Language: English
- Publisher: Mercury Learning and Information
- Publication Date: 2021-03-22
- ISBN-10: 1683926692
- ISBN-13: 9781683926696
- Sales Rank: #1838417 (See Top 100 Books)
Designed as a Java-based textbook for beginning programmers, this book uses game programming as a central pedagogical tool to improve student engagement, learning outcomes, and retention. The new edition includes updating the GUI interface chapters from Swing based to FX based programs. The game programming is incorporated into the text in a way that does not compromise the amount of material traditionally covered in a basic programming or advanced Java programming course, and permits instructors who are not familiar with game programming and computer graphic concepts to realize the pedagogical advantages of using game programming. The book assumes the reader has no prior programming experience. The companion files are available to eBook customers by emailing the publisher [email protected] with proof of purchase. FEATURES: Features content in compliance with the latest ACM/IEEE computer science curriculum guidelines Introduces the basic programming concepts such as strings, loops, arrays, graphics, functions, classes, etc Includes updating the GUI interface chapters (Chapters 11 and 12) from Swing based to FX based Contains material on programming of mobile applications and several simulations that graphically depict unseen runtime processes 4 color throughout with game demos on the companion files Instructor’s resources available upon adoption
Preface xv Acknowledgments xxiii Credits xxv Chapter 1 Introduction 1.1 The Computer System 1.2 A Brief History of Computing 1.2.1 Early Computing Devices 1.2.2 Computers Become a Reality 1.2.3 Computer Generations 1.2.4 More Notable Contributions 1.2.5 Smaller, Faster, Cheaper Computers 1.3 Specifying a Program 1.3.1 Specifying a Game Program 1.4 Sample Student Games 1.5 Java and Platform Independence 1.5.1 The Java Application Programmer Interface 1.6 Object-Oriented Programming Languages 1.7 Integrated Development Environments and the Program Development Process 1.7.1 Mobile-Device Application Development Environments 1.8 Our Game Development Environment: A First Look 1.8.1 The Game Window 1.8.2 The Game Board Coordinate System 1.8.3 Installing and Incorporating the Game Package into a Program 1.8.4 Creating and Displaying a Game Window and Its Title 1.8.5 Changing the Game Board’s Size 1.9 Representing Information in Memory 1.9.1 Representing Character Data 1.9.2 Representing Translated Instructions 1.9.3 Representing Numeric Data 1.10 Chapter Summary Chapter 2 Variables, Input/Output, and Calculations 2.1 The Java Application Program Template 2.2 Variables 2.3 Primitive Variables 2.4 System Console Output 2.4.1 String Output 2.4.2 The Concatenation Operator and Annotated Numeric Output 2.4.3 Escape Sequences 2.5 String Objects and Reference Variables 2.6 Calculations and the Math Class 2.6.1 Arithmetic Calculations and the Rules of Precedence 2.6.2 The Assignment Operator and Assignment Statements 2.6.3 Promotion and Casting 2.6.4 The Math Class 2.7 Dialog Box Output and Input 2.7.1 Message Dialog Boxes 2.7.2 Input Dialog Boxes 2.7.3 Parsing Strings into Numerics 2.8 Graphical Text Output 2.8.1 The drawString Method 2.8.2 The draw Call Back Method 2.8.3 The setFont Method: A First Look 2.9 The Counting Algorithm 2.9.1 A Counting Application: Displaying a Game’s Time 2.10 Formatting Numeric Output: A First Pass 2.10.1 The printf Method 2.11 Chapter Summary Chapter 3 Methods, Classes, and Objects: A First Look 3.1 Methods We Write 3.1.1 Syntax of a Method 3.2 Information Passing 3.2.1 Parameters and Arguments 3.2.2 Scope and Side Effects of Value Parameters 3.2.3 Returned Values 3.2.4 Class Level Variables 87Contents ■ ix 3.3 The API Graphics Class 3.3.1 Changing the Drawing Color 3.3.2 Drawing Lines, Rectangles, Ovals, and Circles 3.4 Object Oriented Programming 3.4.1 What Are Classes and Objects? 3.5 Defining Classes and Creating Objects 3.5.1 Specifying a Class: Unified Modeling Language Diagrams 3.5.2 The Class Code Template 3.5.3 Creating Objects 3.5.4 Displaying an Object 3.5.5 Designing a Graphical Object 3.6 Adding Methods to Classes 3.6.1 The show Method 3.6.2 Constructors and the Keyword this 3.6.3 Private Access and the set/get Methods 3.6.4 The toString and input Methods 3.7 Overloading Constructors 3.8 Passing Objects To and From Worker Methods 3.9 Chapter Summary Chapter 4 Boolean Expressions, Making Decisions, and Disk Input and Output 4.1 Alternatives to Sequential Execution 4.2 Boolean Expressions 4.2.1 Simple Boolean Expressions 4.2.2 Compound Boolean Expressions 4.2.3 Comparing String Objects 4.3 The if Statement 4.4 The if-else Statement 4.4.1 Conditional Expressions 4.5 Nested if Statements 4.6 The switch Statement 4.7 Console Input and the Scanner Class 4.8 Disk Input and Output: A First Look 4.8.1 Sequential Text File Input 4.8.2 Determining the Existence of a File 4.8.3 Sequential Text File Output 4.8.4 Appending Data to an Existing Text File 4.8.5 Deleting, Modifying, and Adding File Data Items 4.8.6 Redirecting the System.in and System.out 4.9 Exceptions: A First Pass 4.10 Chapter Summary Chapter 5 Repeating Statements: Loops 5.1 A Second Alternative to Sequential Execution 5.2 The for Statement 5.2.1 Syntax of the for Statement 5.2.2 A for Loop Application 5.2.3 The Totaling and Averaging Algorithms 5.3 Formatting Numeric Output: A Second Pass 5.3.1 Currency Formatting 5.3.2 The DecimalFormat Class: A Second Look 5.4 Nesting for Loops 5.5 The while Statement 5.5.1 Syntax of the while Statement 5.5.2 Sentinel Loops 5.5.3 Detecting an End of File 5.6 The do-while Statement 5.6.1 Syntax of the do-while Statement 5.7 The break and continue Statements 5.8 Which Loop Statement to Use 5.9 The Random class 5.9.1 The SecureRandom Class 5.10 The Enhanced for Statement 5.11 Chapter Summary Chapter 6 Arrays 6.1 The Origin of Arrays 6.2 The Concept of Arrays 6.3 Declaring Arrays 6.3.1 Dynamic Allocation of Arrays 6.4 Arrays and Loops 6.5 Arrays of Objects 6.5.1 Processing an Array’s Objects 6.6 Passing Arrays Between Methods 6.6.1 Passing Arrays of Primitives to a Worker Method 6.6.2 Passing Arrays of Objects to a Worker Method 6.6.3 Returning an Array from a Worker Method 6.7 Parallel Arrays 6.8 Common Array Algorithms 6.8.1 Searching 6.8.2 Minimums and Maximums 6.8.3 Sorting 6.9 Application Programmer Interface Array Support 6.9.1 The arraycopy Method 6.9.2 The Arrays Class 283Contents ■ xi 6.10 Multi-dimensional Arrays 6.10.1 Two-Dimensional Arrays 6.11 Deleting, Modifying, and Adding Disk File Items 6.12 Chapter Summary Chapter 7 Methods, Classes, and Objects: A Second Look 7.1 Static Data Members 7.2 Methods Invoking Methods Within their Class 7.3 Comparing Objects 7.3.1 Shallow Comparisons 7.3.2 Deep Comparisons 7.4 Copying and Cloning Objects 7.4.1 Shallow Copies 7.4.2 Deep Copies and Clones 7.5 The String Class: A Second Look 7.5.1 Creating Strings from Primitive Values 7.5.2 Converting Strings to Characters 7.5.3 Processing Strings 7.6 The Wrapper Classes: A Second Look 7.6.1 Wrapper Class Objects 7.6.2 Autoboxing and Unboxing 7.6.3 Wrapper Class Constants 7.6.4 The Character Wrapper Class 7.7 Aggregation 7.8 Inner Classes 7.9 Processing Large Numbers 7.10 Enumerated Types 7.11 Chapter Summary Chapter 8 Inheritance 8.1 The Concept of Inheritance 8.2 The UML Diagrams and Language of Inheritance 8.3 Implementing Inheritance 8.3.1 Constructors and Inherited Method Invocations 8.3.2 Overriding Methods 8.3.3 Extending Inherited Data Members 8.4 Using Inheritance in the Design Process 8.4.1 Abstract Classes 8.4.2 Designing Parent Methods to Invoke Child Methods 8.4.3 Abstract Parent Methods 8.4.4 Final Classes 8.4.5 Protected Data Members 8.4.6 Making a Class Inheritance Ready: Best Practices 8.5 Polymorphism 8.5.1 Parent and Child References 8.5.2 Polymorphic Invocations 8.5.3 Polymorphic Arrays 8.5.4 Polymorphism’s Role in Parameter Passing 8.5.5 The methods getClass and getName and the instanceof operator. 8.6 Interfaces 8.6.1 Adapter Classes 8.6.2 Interface Enhancements in Java Versions 8 and 9 8.7 Serializing Objects 8.8 Java Docs 8.9 Chapter Summary Chapter 9 Recursion 9.1 What is Recursion? 9.2 Understanding a Recursive Method’s Execution Path 9.3 Formulating and Implementing Recursive Algorithms 9.3.1 The Base Case, Reduced Problem, and General Solution 9.3.2 Implementing Recursive Algorithms 9.3.3 Practice Problems 9.4 A Recursion Case Study: The Towers of Hanoi 9.5 Problems with Recursion 9.5.1 When to Use Recursion 9.5.2 Dynamic Programming 9.6 Chapter Summary Chapter 10 Exceptions: A Second Look 10.1 An Overview 10.2 Java’s Exception Classes and Exception Objects 10.3 Processing Thrown Exceptions 10.3.1 Non-error Checking Use of Exceptions 10.3.2 The finally Clause 10.4 The Throw Statement and Error Messages 10.5 Defining Exception Classes 10.6 Chapter Summary Chapter 11 Graphical User Interfaces 11.1 Overview 11.2 Enhancing Swing Dialog Boxes 11.3 FX Dialog Boxes 11.3.1 FX Message Dialog Boxes 11.3.2 The FX Program Structure 11.3.3 FX Input Dialog Boxes 499Contents ■ xiii 11.3.4 A Complete FX Application 11.3.5 FX Choice Dialog Boxes 11.4 Creating a GUI Interface 11.4.1 Designing the Interface 11.4.2 Creating Controls and Setting Their Properties 11.4.3 Adding the Controls to a GridPane Container 11.5 Event Processing 11.5.1 Implementing an Event Handler 11.5.2 Registering the Event Handler 11.5.3 Drawing 2-D Shapes 11.5.4 Keyboard, Mouse, and Key Frame Timer Events 11.6 The Pane Container and Layout Managers: A Second Look 11.6.1 Working with the Pane Container 11.6.2 VBox and HBox Layout Managers 11.6.3 FlowPane Layout Manager 11.6.4 BorderPane Layout Manager 11.7 Chapter Summary Chapter 12 Graphical User Interfaces: A Second Look 12.1 Borders, Check Boxes and Radio Buttons 12.1.1 Pane Borders 12.1.2 Check Boxes 12.1.3 Radio Buttons 12.2 Combo Boxes and List Views 12.3 Menus 12.3.1 Drop-Down Menus 12.3.2 Pop-Up Menus 12.4 File-Chooser and Color-Picker Dialog Boxes 12.4.1 File-Chooser Dialog Boxes 12.4.2 Color-Picker Control 12.5 Lambda Expressions and Functional Interfaces: A Second Look 12.6 Scene Builder 12.7 Chapter Summary Chapter 13 Generics and the API Collection Framework 13.1 Overview 13.2 Generic Methods 13.2.1 Overloading Generic Methods 13.2.2 Arrays as Generic Parameters and Returned Values 13.2.3 Copying a Generic Array 13.2.4 Operating on Generic Objects 13.3 Generic Classes 13.3.1 Generic Data Structure Classes 13.4 The API Collections Framework 13.4.1 Framework Interfaces 13.4.2 Framework Algorithms: The Collections Class 13.4.3 The LinkedList and ArrayList Classes 13.4.4 The HashSet, TreeSet, and LinkedSet Classes 13.4.5 The ArrayDeque and Priority Queue Classes 13.4.6 The HashMap, TreeMap, and LinkedHashMap Classes 13.5 Streams and Functional Programming 13.5.1 A Stream Data Source 13.5.2 Stream Terminal Tasks 13.5.3 Stream Intermediate Tasks 13.6 Chapter Summary Chapter 14 Multithreading and Concurrency 14.1 Overview 14.2 Creating and Initiating Threads 14.3 Thread States 14.3.1 The New, Runnable, and Terminated States 14.3.2 The Blocked, Waiting, and Timed Waiting States 14.4 The Producer-Consumer Problem 14.5 Solutions to the Producer Consumer Problem 14.5.1 Synchronizing a Buffer Class: Synchronized Methods 14.5.2 The API ArrayBlockingQueue Class 14.6 The Synchronized Statement 14.7 Chapter Summary Appendix A Description of the Game Environment Appendix B Using the Game Environment Package Appendix C ASCII Table Appendix D Java Key Words Appendix E Java Operators and Their Relative Precedence Appendix F Using the Game Glossary of Programming Terms Appendix G Using the Online API Documentation Appendix H Solutions to Selected Odd Knowledge Exercises Index
Donate to keep this site alive
1. Disable the AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.