From 4a710abcdca97bfec2a101a509446d1da447a803 Mon Sep 17 00:00:00 2001
From: Habiba Sorour
Date: Tue, 11 Aug 2026 20:19:22 +0300
Subject: [PATCH 1/8] fixed the error
---
source/ch4_conditionals.ptx | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/source/ch4_conditionals.ptx b/source/ch4_conditionals.ptx
index 1f99114..0cd7e57 100644
--- a/source/ch4_conditionals.ptx
+++ b/source/ch4_conditionals.ptx
@@ -5,6 +5,7 @@
Conditionals
Using Conditional Statements in Java
+
conditional statements
Conditional statements in Python and Java are very similar.
In Python we have three patterns:
@@ -50,7 +51,8 @@ if score >= 90: # Note the colon at the end of the line
In Java, the parentheses around the condition are required because it is technically a function that evaluates to True or False.
-
+
+
Using the if - else Statement
From 9013d7d95f1d07db5579c684f5f93595da24c65a Mon Sep 17 00:00:00 2001
From: Habiba Sorour
Date: Tue, 11 Aug 2026 21:57:48 +0300
Subject: [PATCH 2/8] fixed
---
source/ch4_conditionals.ptx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source/ch4_conditionals.ptx b/source/ch4_conditionals.ptx
index 0cd7e57..08463b3 100644
--- a/source/ch4_conditionals.ptx
+++ b/source/ch4_conditionals.ptx
@@ -51,7 +51,7 @@ if score >= 90: # Note the colon at the end of the line
In Java, the parentheses around the condition are required because it is technically a function that evaluates to True or False.
-
+
Using the if - else Statement
From 14be3761b4a4c8e39594ac807dedf6bc814f5734 Mon Sep 17 00:00:00 2001
From: Habiba Sorour
Date: Tue, 11 Aug 2026 22:45:53 +0300
Subject: [PATCH 3/8] added a subsection
---
source/ch4_conditionals.ptx | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/source/ch4_conditionals.ptx b/source/ch4_conditionals.ptx
index 08463b3..0522a87 100644
--- a/source/ch4_conditionals.ptx
+++ b/source/ch4_conditionals.ptx
@@ -8,10 +8,12 @@
conditional statements
Conditional statements in Python and Java are very similar.
- In Python we have three patterns:
+ In Python we have three patterns/
-
+
+
+ Using the if Statement
shows how the simple if statement is written in Python.
@@ -51,7 +53,7 @@ if score >= 90: # Note the colon at the end of the line
In Java, the parentheses around the condition are required because it is technically a function that evaluates to True or False.
-
+
Using the if - else Statement
From 3b997c6f6c1055cfdfa29068610f3755b0d412c8 Mon Sep 17 00:00:00 2001
From: Habiba Sorour
Date: Tue, 11 Aug 2026 22:51:02 +0300
Subject: [PATCH 4/8] fixed a dot
---
source/ch4_conditionals.ptx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source/ch4_conditionals.ptx b/source/ch4_conditionals.ptx
index 0522a87..623587a 100644
--- a/source/ch4_conditionals.ptx
+++ b/source/ch4_conditionals.ptx
@@ -8,7 +8,7 @@
conditional statements
Conditional statements in Python and Java are very similar.
- In Python we have three patterns/
+ In Python we have three patterns.
From a6860ff3aaada9d514893e2675ca16340974012c Mon Sep 17 00:00:00 2001
From: Habiba Sorour
Date: Tue, 11 Aug 2026 23:40:33 +0300
Subject: [PATCH 5/8] fixedthe error
---
source/ch3_javadatatypes.ptx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/source/ch3_javadatatypes.ptx b/source/ch3_javadatatypes.ptx
index a08b796..6c69c36 100644
--- a/source/ch3_javadatatypes.ptx
+++ b/source/ch3_javadatatypes.ptx
@@ -867,7 +867,7 @@ public class Histo {
-
+
for i in range(2, 102, 2)
@@ -904,7 +904,7 @@ public class Histo {
for (int x = 0, int y = 0; x < 10; x++, y += 2)
-
+
From ce044bc87a9224bc3ebdfdfdcd4eece85344373d Mon Sep 17 00:00:00 2001
From: "nshizirungudieumerci@gmail.com"
Date: Wed, 12 Aug 2026 11:05:14 -0400
Subject: [PATCH 6/8] added a parsons problem in section 8.2 which introduces
students to creating files
---
source/ch8_filehandling.ptx | 42 +++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/source/ch8_filehandling.ptx b/source/ch8_filehandling.ptx
index a610f37..7a7cf33 100644
--- a/source/ch8_filehandling.ptx
+++ b/source/ch8_filehandling.ptx
@@ -172,6 +172,48 @@ public class CreateFile {
You may have noticed the use of another method from the File class; getName(). This method returns a string containing the name of the file.
+
+
+
+
+ Construct a short Java program that creates a File object for "myfile.txt"
+ and prints it. Drag the blocks into the correct order on the right.
+
+
+
+
+
+ import java.io.File;
+
+
+ import java.io.Scanner;
+
+
+
+
+ public class CreateFile {
+ public static void main(String[] args) {
+
+
+
+
+ File myFile = new File("myfile.txt");
+
+
+ File myFile = new File();
+
+
+
+
+ System.out.println(myFile);
+
+
+
+ }
+ }
+
+
+
From 9d3d9c69a12987c01f67098894888a83e4f6073e Mon Sep 17 00:00:00 2001
From: "nshizirungudieumerci@gmail.com"
Date: Wed, 12 Aug 2026 13:43:33 -0400
Subject: [PATCH 7/8] added a parsons problem to section 8.3
---
source/ch8_filehandling.ptx | 38 +++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/source/ch8_filehandling.ptx b/source/ch8_filehandling.ptx
index 7a7cf33..d9656b0 100644
--- a/source/ch8_filehandling.ptx
+++ b/source/ch8_filehandling.ptx
@@ -287,6 +287,44 @@ public class CreateFile {
You may have noticed that there are some new methods you haven't seen yet. The hasNextLine() method checks if there is a next line in the file, and returns false if there isn't. This method allows us to iterate over every line till there is no next line. The nextLine() method of the Scanner object returns the next line in the file as a string.
+
+
+
+
+ Construct the part of a Java program that opens a file with a Scanner and
+ prints each line until there are no more lines. Drag the blocks into the correct order on the right.
+
+
+
+
+
+ try (Scanner fileReader = new Scanner(new File(filename))) {
+
+
+ try (Scanner fileReader = new Scanner(filename)) {
+
+
+
+
+
+ while (fileReader.hasNextLine()) {
+
+
+ while (fileReader.nextLine()) {
+
+
+
+
+ String data = fileReader.nextLine();
+ System.out.println(data);
+
+
+
+ }
+ }
+
+
+
From c7f4c7b65d38972f4705a1d97b1e1f7c9afb6fb9 Mon Sep 17 00:00:00 2001
From: "nshizirungudieumerci@gmail.com"
Date: Wed, 12 Aug 2026 15:37:09 -0400
Subject: [PATCH 8/8] added a select all that apply multiple choice based
question to section9.3
---
source/ch9_commonmistakes.ptx | 50 +++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/source/ch9_commonmistakes.ptx b/source/ch9_commonmistakes.ptx
index 64b59cd..4dca391 100644
--- a/source/ch9_commonmistakes.ptx
+++ b/source/ch9_commonmistakes.ptx
@@ -115,6 +115,56 @@
The 'cannot find symbol' error for the variable count on line 6 indicates that count was used before it was declared within the Histo class. In Java, all variables must be explicitly declared with a data type (e.g., int, String, ArrayList<Integer>) before they can be assigned a value or referenced in any way. The arrow in the error message points to where the undeclared variable count was first encountered. To resolve this, count needs to be declared with its appropriate type (e.g., ArrayList<Integer> count;) before any attempt to initialize or use it.
+
+
+
+ Based on , select all of the
+ statements that are true about declaring variables in Java.
+
+
+
+
+
+ Every variable must be declared with a data type before it is used.
+
+
+ Correct! Java requires a variable to be declared with its type before it can be assigned or referenced.
+
+
+
+
+ The "cannot find symbol" error happens because count was used before being declared.
+
+
+ Correct! That error means the compiler reached a variable it has no declaration for.
+
+
+
+
+ Writing ArrayList<Integer> count; before using count would fix the "cannot find symbol" error.
+
+
+ Correct! Declaring count with its type resolves the error.
+
+
+
+
+ Java lets you use a variable without declaring it first, just like Python.
+
+
+ Incorrect. Unlike Python, Java requires all variables to be declared before use.
+
+
+
+
+ The error can be fixed by adding an import statement.
+
+
+ Incorrect. The import is already present; the problem is the missing variable declaration, not a missing import.
+
+
+
+