From 035b179bc67ffa8e701987fb857b9d5fdeed47e9 Mon Sep 17 00:00:00 2001 From: lalmendra <109772135+lalmendra@users.noreply.github.com> Date: Fri, 25 Sep 2026 23:56:27 -0300 Subject: [PATCH 1/3] Update field_access.md --- src/classes/field_access.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/classes/field_access.md b/src/classes/field_access.md index 09865939..d38fca27 100644 --- a/src/classes/field_access.md +++ b/src/classes/field_access.md @@ -1,7 +1,7 @@ # Field Access You can access the value of any field in a class by writing the name of a variable holding an instance -of that class, `.`, then the name of that field. +of that class, plus a `.`, then the name of that field. ```java class Muppet { From 17205d867ad6e152c3d849465b2e3d4c6a9b525e Mon Sep 17 00:00:00 2001 From: lalmendra <109772135+lalmendra@users.noreply.github.com> Date: Sat, 26 Sep 2026 02:17:41 -0300 Subject: [PATCH 2/3] Update challenges.md sent challenge 4 to position 6, as it seemed the most difficult, at least to me --- src/instance_methods/challenges.md | 60 +++++++++++++++--------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/instance_methods/challenges.md b/src/instance_methods/challenges.md index 45cc118f..2a9c3a08 100644 --- a/src/instance_methods/challenges.md +++ b/src/instance_methods/challenges.md @@ -111,34 +111,6 @@ void main() { ## Challenge 4. -Make a `Rectangle` class which has a `width` field and a `height` -field. Give it an instance method named `toCharArray` which gives -a `char[]` that can be printed to display a rectangle of the given -width and height. - -```java,editable -// ------------ -// CODE HERE -// ------------ - -void main() { - Rectangle rectangle = new Rectangle(); - rectangle.width = 3; - rectangle.height = 4; - - /* - *** - *** - *** - *** - */ - char[] c = rectangle.toCharArray(); - IO.println(c); -} -``` - -## Challenge 5. - Update the definition for the `Taco` class so that it has a method named `deluxe`. This should set the taco to have beef, sour cream, cheese, and onion. Use the existing instance methods instead of directly accessing @@ -185,7 +157,7 @@ void main() { } ``` -## Challenge 6. +## Challenge 5. Why doesn't this code function as you'd expect? Fix it by changing one line. @@ -203,4 +175,32 @@ void main() { oscar.setGrouchy(true); IO.println(oscar.grouchy); } -``` \ No newline at end of file +``` + +## Challenge 6. + +Make a `Rectangle` class which has a `width` field and a `height` +field. Give it an instance method named `toCharArray` which gives +a `char[]` that can be printed to display a rectangle of the given +width and height. + +```java,editable +// ------------ +// CODE HERE +// ------------ + +void main() { + Rectangle rectangle = new Rectangle(); + rectangle.width = 3; + rectangle.height = 4; + + /* + *** + *** + *** + *** + */ + char[] c = rectangle.toCharArray(); + IO.println(c); +} +``` From bb40782338195555142c48e6c5652d10fb748ce7 Mon Sep 17 00:00:00 2001 From: lalmendra <109772135+lalmendra@users.noreply.github.com> Date: Sat, 26 Sep 2026 02:33:21 -0300 Subject: [PATCH 3/3] Update challenges.md Using just "IO.println(c)" was printing c as an Object. Adjusted to convert it to String before printing --- src/instance_methods/challenges.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/instance_methods/challenges.md b/src/instance_methods/challenges.md index 2a9c3a08..64612248 100644 --- a/src/instance_methods/challenges.md +++ b/src/instance_methods/challenges.md @@ -201,6 +201,6 @@ void main() { *** */ char[] c = rectangle.toCharArray(); - IO.println(c); + IO.println(new String(c)); } ```