Book description
Dive into the world of Java and algorithmic thinking with this book. This comprehensive guide for beginners covers everything from basic computer operations to advanced programming concepts.
Key Features
 Introduction to Java & algorithmic thinking with a proper guide from basic to advanced concepts
 Tips and tricks to enhance programming efficiency, and exercises for realworld application
 Detailed exploration of control structures, data structures, and subprograms
Book Description
Begin your programming journey with a comprehensive course designed to introduce you to the world of Java and algorithmic thinking. The course starts by laying a solid foundation with an understanding of how computers work and an introduction to integrated development environments. As you advance, you'll delve into essential Java concepts, learning about variables, constants, and basic algorithmic concepts that are crucial for any aspiring programmer.
Moving forward, the course offers a deep dive into more complex topics, including handling input and output, using operators, and creating trace tables. You'll get handson experience with Visual Studio Code and explore sequence control structures, manipulating numbers, and crafting complex mathematical expressions.
In the final stages, the course covers advanced topics such as data structures, subprograms, and objectoriented programming. You'll learn to manipulate onedimensional and twodimensional arrays, work with HashMaps, and understand the intricacies of userdefined subprograms. The course concludes with a focus on file management and offers numerous tips and tricks to enhance your programming efficiency. By the end, you'll have a strong foundation in Java programming and algorithmic thinking, wellprepared to tackle more advanced challenges.
What you will learn
 Understand the fundamentals of how computers work
 Master Java programming basics and IDEs
 Develop proficiency in handling operators, and trace tables
 Implement sequence and decision control structures in programming
 Manipulate numbers, strings, and complex expressions
 Utilize arrays, HashMaps, and other data structures effectively
Who this book is for
This course is perfect for complete beginners with no prior programming experience, including high school students and hobbyists. It is also suitable for those with a basic understanding of computers who wish to deepen their knowledge of Java and algorithmic thinking. Additionally, college students in noncomputer science majors, professionals seeking a career change into tech, and educators looking to incorporate programming into their curriculum will benefit from this comprehensive guide. No prerequisites are required, making it accessible to anyone eager to learn.
Table of contents
 Table of Contents
 Preface
 Part I Introductory Knowledge

Part II Getting Started with Java

Chapter 4 Introduction to Basic Algorithmic Concepts
 4.1 What is an Algorithm?
 4.2 The Algorithm for Making a Cup of Tea
 4.3 Properties of an Algorithm
 4.4 Okay About Algorithms. But What is a Computer Program Anyway?
 4.5 The Three Parties!
 4.6 The Three Main Stages Involved in Creating an Algorithm
 4.7 Flowcharts
 4.8 What are ”Reserved Words”?
 4.9 What is the Difference Between a Statement and a Command?
 4.10 What is Structured Programming?
 4.11 The Three Fundamental Control Structures
 4.12 Your First Java Program
 4.13 What is the Difference Between a Syntax Error, a Logic Error, and a Runtime Error?
 4.14 What “Debugging” Means
 4.15 Commenting Your Code
 4.16 UserFriendly Programs
 4.17 Review Questions: True/False
 4.18 Review Questions: Multiple Choice

Chapter 5 Variables and Constants
 5.1 What is a Variable?
 5.2 What is a Constant?
 5.3 How Many Types of Variables and Constants Exist?
 5.4 Rules and Conventions for Naming Variables and Constants in Java
 5.5 What Does the Phrase “Declare a Variable” Mean?
 5.6 How to Declare Variables in Java
 5.7 How to Declare Constants in Java
 5.8 Review Questions: True/False
 5.9 Review Questions: Multiple Choice
 5.10 Review Exercises
 Chapter 6 Handling Input and Output
 Chapter 7 Operators
 Chapter 8 Trace Tables
 Chapter 9 Using Visual Studio Code
 Review in “Getting Started with Java”

Chapter 4 Introduction to Basic Algorithmic Concepts

Part III Sequence Control Structures

Chapter 10 Introduction to Sequence Control Structures

10.1 What is the Sequence Control Structure?
 Exercise 10.11 Calculating the Area of a Rectangle
 Exercise 10.12 Calculating the Area of a Circle
 Exercise 10.13 Where is the Car? Calculating Distance Traveled
 Exercise 10.14 Kelvin to Fahrenheit
 Exercise 10.15 Calculating Sales Tax
 Exercise 10.16 Calculating a Sales Discount
 Exercise 10.17 Calculating a Sales Discount and Tax
 10.2 Review Exercises

10.1 What is the Sequence Control Structure?
 Chapter 11 Manipulating Numbers
 Chapter 12 Complex Mathematical Expressions
 Chapter 13 Exercises With a Quotient and a Remainder
 Chapter 14 Manipulating Strings
 Review in “Sequence Control Structures”

Chapter 10 Introduction to Sequence Control Structures

Part IV Decision Control Structures

Chapter 15 Making Questions
 15.1 Introduction
 15.2 What is a Boolean Expression?
 15.3 How to Write Simple Boolean Expressions
 15.4 Logical Operators and Complex Boolean Expressions
 15.5 Assigning the Result of a Boolean Expression to a Variable
 15.6 What is the Order of Precedence of Logical Operators?
 15.7 What is the Order of Precedence of Arithmetic, Comparison, and Logical Operators?
 15.8 How to Negate Boolean Expressions
 15.9 Review Questions: True/False
 15.10 Review Questions: Multiple Choice
 15.11 Review Exercises
 Chapter 16 The SingleAlternative Decision Structure
 Chapter 17 The DualAlternative Decision Structure
 Chapter 18 The MultipleAlternative Decision Structure
 Chapter 19 The Case Decision Structure
 Chapter 20 Nested Decision Control Structures
 Chapter 21 More about Flowcharts with Decision Control Structures

Chapter 22 Tips and Tricks with Decision Control Structures
 22.1 Introduction
 22.2 Choosing a Decision Control Structure
 22.3 Streamlining the Decision Control Structure
 22.4 Logical Operators – to Use, or not to Use: That is the Question!
 22.5 Merging Two or More SingleAlternative Decision Structures
 22.6 Replacing Two SingleAlternative Decision Structures with a DualAlternative One
 22.7 Put the Boolean Expressions Most Likely to be True First
 22.8 Why is Code Indentation so Important?
 22.9 Review Questions: True/False
 22.10 Review Questions: Multiple Choice
 22.11 Review Exercises

Chapter 23 More with Decision Control Structures

23.1 Simple Exercises with Decision Control Structures
 Exercise 23.11 Is it an Integer?
 Exercise 23.12 Validating Data Input and Finding Odd and Even Numbers
 Exercise 23.13 Where is the Tollkeeper?
 Exercise 23.14 The Most Scientific Calculator Ever!
 Exercise 23.15 Converting Gallons to Liters, and Vice Versa
 Exercise 23.16 Converting Gallons to Liters, and Vice Versa (with Data Validation)
 23.2 Finding Minimum and Maximum Values with Decision Control Structures
 23.3 Decision Control Structures in Solving Mathematical Problems

23.4 Exercises with Series of Consecutive Ranges of Values
 Exercise 23.41 Calculating the Discount
 Exercise 23.42 Validating Data Input and Calculating the Discount
 Exercise 23.43 Sending a Parcel
 Exercise 23.44 Finding the Values of y
 Exercise 23.45 Progressive Rates and Electricity Consumption
 Exercise 23.46 Progressive Rates and Text Messaging Services
 23.5 Exercises of a General Nature with Decision Control Structures
 23.6 Boolean Expressions Reference and Handy Tips
 23.7 Review Exercises

23.1 Simple Exercises with Decision Control Structures
 Review in “Decision Control Structures”

Chapter 15 Making Questions

Part V Loop Control Structures
 Chapter 24 Introduction to Loop Control Structures

Chapter 25 PreTest, MidTest and PostTest Loop Structures

25.1 The PreTest Loop Structure
 Exercise 25.11 Designing the Flowchart and Counting the Total Number of Iterations
 Exercise 25.12 Counting the Total Number of Iterations
 Exercise 25.13 Counting the Total Number of Iterations
 Exercise 25.14 Counting the Total Number of Iterations
 Exercise 25.15 Finding the Sum of Four Numbers
 Exercise 25.16 Finding the Sum of Odd Numbers
 Exercise 25.17 Finding the Sum of N Numbers
 Exercise 25.18 Finding the Sum of an Unknown Quantity of Numbers
 Exercise 25.19 Finding the Product of 20 Numbers

25.2 The PostTest Loop Structure
 Exercise 25.21 Designing the Flowchart and Counting the Total Number of Iterations
 Exercise 25.22 Counting the Total Number of Iterations
 Exercise 25.23 Designing the Flowchart and Counting the Total Number of Iterations
 Exercise 25.24 Counting the Total Number of Iterations
 Exercise 25.25 Finding the Product of N Numbers
 25.3 The MidTest Loop Structure
 25.4 Review Questions: True/False
 25.5 Review Questions: Multiple Choice
 25.6 Review Exercises

25.1 The PreTest Loop Structure

Chapter 26 Definite Loops

26.1 The for statement
 Exercise 26.11 Creating the Trace Table
 Exercise 26.12 Creating the Trace Table
 Exercise 26.13 Counting the Total Number of Iterations
 Exercise 26.14 Finding the Sum of Four Numbers
 Exercise 26.15 Finding the Square Roots from 0 to N
 Exercise 26.16 Finding the Sum of 1 + 2 + 3 + … + 100
 Exercise 26.17 Finding the Product of 2 × 4 × 6 × 8 × 10
 Exercise 26.18 Finding the Sum of 22 + 42 + 62 + … (2N)2
 Exercise 26.19 Finding the Sum of 33 + 66 + 99 + … (3N)3N
 Exercise 26.110 Finding the Average Value of Positive Numbers
 Exercise 26.111 Counting the Vowels
 26.2 Rules that Apply to ForLoops
 26.3 Review Questions: True/False
 26.4 Review Questions: Multiple Choice
 26.5 Review Exercises

26.1 The for statement
 Chapter 27 Nested Loop Control Structures
 Chapter 28 More about Flowcharts with Loop Control Structures

Chapter 29 Tips and Tricks with Loop Control Structures
 29.1 Introduction
 29.2 Choosing a Loop Control Structure
 29.3 The “Ultimate” Rule
 29.4 Breaking Out of a Loop
 29.5 Cleaning Out Your Loops
 29.6 Endless Loops and How to Stop Them
 29.7 The “From Inner to Outer” Method
 29.8 Review Questions: True/False
 29.9 Review Questions: Multiple Choice
 29.10 Review Exercises

Chapter 30 More with Loop Control Structures

30.1 Simple Exercises with Loop Control Structures
 Exercise 30.11 Counting the Numbers According to Which is Greater
 Exercise 30.12 Counting the Numbers According to Their Digits
 Exercise 30.13 How Many Numbers Fit in a Sum
 Exercise 30.14 Finding the Total Number of Positive Integers
 Exercise 30.15 Iterating as Many Times as the User Wishes
 Exercise 30.16 Finding the Sum of the Digits
 30.2 Exercises with Nested Loop Control Structures
 30.3 Data Validation with Loop Control Structures
 30.4 Finding Minimum and Maximum Values with Loop Control Structures

30.5 Using Loop Control Structures to Solve Mathematical Problems
 Exercise 30.51 Calculating the Area of as Many Triangles as the User Wishes
 Exercise 30.52 Finding x and y
 Exercise 30.53 The Russian Multiplication Algorithm
 Exercise 30.54 Finding the Number of Divisors
 Exercise 30.55 Is the Number a Prime?
 Exercise 30.56 Finding all Prime Numbers from 1 to N
 Exercise 30.57 Heron's Square Root
 Exercise 30.58 Calculating π
 Exercise 30.59 Approximating a Real with a Fraction
 30.6 Exercises of a General Nature with Loop Control Structures
 30.7 Review Questions: True/False
 30.8 Review Exercises

30.1 Simple Exercises with Loop Control Structures
 Review in “Loop Control Structures”

Part VI Data Structures in Java

Chapter 31 OneDimensional Arrays and HashMaps
 31.1 Introduction
 31.2 What is an Array?
 31.3 Creating OneDimensional Arrays in Java
 31.4 How to Get Values from a OneDimensional Array
 31.5 How to Alter the Value of an Array Element
 31.6 How to Iterate Through a OneDimensional Array

31.7 How to Add UserEntered Values to a OneDimensional Array
 Exercise 31.71 Displaying Words in Reverse Order
 Exercise 31.72 Displaying Positive Numbers in Reverse Order
 Exercise 31.73 Finding the Average Value
 Exercise 31.74 Displaying Reals Only
 Exercise 31.75 Displaying Elements with OddNumbered Indexes
 Exercise 31.76 Displaying Even Numbers in Odd–Numbered Index Positions
 31.8 What is a HashMap?
 31.9 Creating HashMaps in Java
 31.10 How to Get a Value from a HashMap
 31.11 How to Alter the Value of a HashMap Element
 31.12 How to Iterate Through a HashMap
 31.13 Review Questions: True/False
 31.14 Review Questions: Multiple Choice
 31.15 Review Exercises

Chapter 32 TwoDimensional Arrays
 32.1 Creating TwoDimensional Arrays in Java
 32.2 How to Get Values from TwoDimensional Arrays
 32.3 How to Iterate Through a TwoDimensional Array
 32.4 How to Add UserEntered Values to a TwoDimensional Array
 32.5 What's the Story on Variables i and j?
 32.6 Square Matrices
 32.7 Review Questions: True/False
 32.8 Review Questions: Multiple Choice
 32.9 Review Exercises

Chapter 33 Tips and Tricks with Data Structures
 33.1 Introduction
 33.2 Processing Each Row Individually
 33.3 Processing Each Column Individually
 33.4 How to Use More Than One Data Structures in a Program
 33.5 Creating a OneDimensional Array from a TwoDimensional Array
 33.6 Creating a TwoDimensional Array from a OneDimensional Array
 33.7 Useful Data Structures Methods (Subprograms), and More
 33.8 Review Questions: True/False
 33.9 Review Questions: Multiple Choice
 33.10 Review Exercises

Chapter 34 More with Data Structures

34.1 Simple Exercises with Arrays
 Exercise 34.11 Creating an Array that Contains the Average Values of its Neighboring Elements
 Exercise 34.12 Creating an Array with the Greatest Values
 Exercise 34.13 Merging OneDimensional Arrays
 Exercise 34.14 Creating Two Arrays – Separating Positive from Negative Values
 Exercise 34.15 Creating an Array with Those who Contain Digit 5
 34.2 Data Validation with Arrays

34.3 Finding Minimum and Maximum Values in Arrays
 Exercise 34.31 Which Depth is the Greatest?
 Exercise 34.32 Which Lake is the Deepest?
 Exercise 34.33 Which Lake, in Which Country, Having Which Average Area, is the Deepest?
 Exercise 34.34 Which Students Have got the Greatest Grade?
 Exercise 34.35 Finding the Minimum Value of a TwoDimensional Array
 Exercise 34.36 Finding the City with the Coldest Day
 Exercise 34.37 Finding the Minimum and the Maximum Value of Each Row

34.4 Sorting Arrays
 Exercise 34.41 The Bubble Sort Algorithm – Sorting OneDimensional Arrays with Numeric Values
 Exercise 34.42 Sorting OneDimensional Arrays with Alphanumeric Values
 Exercise 34.43 Sorting OneDimensional Arrays While Preserving the Relationship with a Second Array
 Exercise 34.44 Sorting Last and First Names
 Exercise 34.45 Sorting a TwoDimensional Array
 Exercise 34.46 The Modified Bubble Sort Algorithm – Sorting OneDimensional Arrays
 Exercise 34.47 The Selection Sort Algorithm – Sorting OneDimensional Arrays
 Exercise 34.48 Sorting OneDimensional Arrays While Preserving the Relationship with a Second Array
 Exercise 34.49 The Insertion Sort Algorithm – Sorting OneDimensional Arrays
 Exercise 34.410 The Three Worst Elapsed Times

34.5 Searching Elements in Data Structures
 Exercise 34.51 The Linear Search Algorithm – Searching in a OneDimensional Array that may Contain the Same Value Multiple Times
 Exercise 34.52 Display the Last Names of All Those People Who Have the Same First Name
 Exercise 34.53 The Linear Search Algorithm – Searching in a TwoDimensional Array that May Contain the Same Value Multiple Times
 Exercise 34.54 The Linear Search Algorithm – Searching in a OneDimensional Array that Contains Unique Values
 Exercise 34.55 Searching for a Social Security Number
 Exercise 34.56 The Linear Search Algorithm – Searching in a TwoDimensional Array that Contains Unique Values
 Exercise 34.57 Checking if a Value Exists in all Columns
 Exercise 34.58 The Binary Search Algorithm – Searching in a Sorted OneDimensional Array
 Exercise 34.59 Display all the Historical Events for a Country
 Exercise 34.510 Searching in Each Column of a TwoDimensional Array

34.6 Exercises of a General Nature with Data Structures
 Exercise 34.61 On Which Days was There a Possibility of Snow?
 Exercise 34.62 Was There Any Possibility of Snow?
 Exercise 34.63 In Which Cities was There a Possibility of Snow?
 Exercise 34.64 Display from Highest to Lowest Grades by Student, and in Alphabetical Order
 Exercise 34.65 Archery at the Summer Olympics
 Exercise 34.66 The Five Best Scorers
 Exercise 34.67 Counting the Frequency of Vowels
 34.7 Review Questions: True/False
 34.8 Review Exercises

34.1 Simple Exercises with Arrays
 Review in “Data Structures in Java”

Chapter 31 OneDimensional Arrays and HashMaps

Part VII Subprograms
 Chapter 35 Introduction to Subprograms

Chapter 36 UserDefined Subprograms
 36.1 Subprograms that Return a Value
 36.2 How to Make a Call to a Method
 36.3 Subprograms that Return no Values
 36.4 How to Make a Call to a void Method
 36.5 Formal and Actual Arguments
 36.6 How Does a Method Execute?
 36.7 How Does a void Method Execute?
 36.8 Review Questions: True/False
 36.9 Review Exercises

Chapter 37 Tips and Tricks with Subprograms
 37.1 Can Two Subprograms use Variables of the Same Name?
 37.2 Can a Subprogram Call Another Subprogram?
 37.3 Passing Arguments by Value and by Reference
 37.4 Returning an Array
 37.5 Overloading Methods
 37.6 The Scope of a Variable
 37.7 Converting Parts of Code into Subprograms
 37.8 Recursion
 37.9 Review Questions: True/False
 37.10 Review Exercises
 Chapter 38 More with Subprograms
 Review in “Subprograms”

Part VIII ObjectOriented Programming

Chapter 39 Introduction to ObjectOriented Programming
 39.1 What is ObjectOriented Programming?
 39.2 Classes and Objects in Java
 39.3 The Constructor and the Keyword this
 39.4 Passing Initial Values to the Constructor
 39.5 Getter and Setter Methods
 39.6 Can a Method Call Another Method of the Same Class?
 39.7 Class Inheritance
 39.8 Review Questions: True/False
 39.9 Review Exercises
 Review in “ObjectOriented Programming”

Chapter 39 Introduction to ObjectOriented Programming

Part IX Files
 Chapter 40 Introduction to Files

Chapter 41 More with Files

41.1 Exercises of a General Nature with Files
 Exercise 41.11 Calculating the Sum of 10 Numbers
 Exercise 41.12 Calculating the Average Value of an Unknown Quantity of Numbers
 Exercise 41.13 Finding Minimum and Maximum Values
 Exercise 41.14 Concatenating Files
 Exercise 41.15 Searching in a File
 Exercise 41.16 Combining Files with Subprograms
 41.2 Review Exercises

41.1 Exercises of a General Nature with Files
 Review in “Files”
 Some Final Words from the Author
Product information
 Title: Java and Algorithmic Thinking for the Complete Beginner
 Author(s):
 Release date: June 2024
 Publisher(s): Packt Publishing
 ISBN: 9781836200130
You might also like
book
C++ and Algorithmic Thinking for the Complete Beginner
Dive into the essentials of C++ and algorithmic thinking with this book. This comprehensive guide is …
article
Use GitHub Copilot: Additional Tips
Using GitHub Copilot can feel like magic. The tool automatically fills out entire blocks of codebut …
article
Use Github Copilot for Prompt Engineering
Using GitHub Copilot can feel like magic. The tool automatically fills out entire blocks of codebut …
book
100 Java Mistakes and How to Avoid Them
Dodge the common mistakes that even senior developers make, take full advantage of static analysis tools, …