You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<a href="https://play.juicemind.com/dashboard/teams/Mk2wWMTqPkekcxTDWqRn/item/2e6655aa-a1b1-446e-9302-8ae43ab07e54#18fe2d0b-9011-40b1-b384-f956576a86a7" target="_blank">Scanner input example in JuiceMind</a>
184
184
185
+
.. |JavaIOExampleReplit| raw:: html
185
186
186
-
.. |JavaIOConsole| raw:: html
187
+
<a href="https://replit.com/@BerylHoffman/JavaIOExample" target="_blank">Scanner input example in Replit</a>
Variables are a powerful abstraction in programming because the same algorithm can be used with different input values saved in variables. The code below using the ``Scanner`` class will say hello to anyone who types in their name and will have different results for different name values. First, type in your name below the code and then click on run. Try again with a friend's name. The code works for any name: behold, the power of variables!
@@ -230,7 +234,7 @@ Variables are a powerful abstraction in programming because the same algorithm c
230
234
}
231
235
232
236
233
-
Although you will not be tested in the AP CSA exam on using the Java input or the ``Scanner`` or ``Console`` classes, learning how to do input in Java is very useful and fun. For more information on using the ``Scanner`` class, go to https://www.w3schools.com/java/java_user_input.asp, and for the newer ``Console`` class, https://howtodoinjava.com/java-examples/console-input-output/. We are limited with the one way communication with the Java server in this Runestone ebook, but in most IDEs like replit, the input/output would be more interactive. Here are some examples in replit for |JavaIOExample| using the ``Scanner`` class and |JavaIOConsole| using the ``Console`` class that you can try out.
237
+
Although you will not be tested in the AP CSA exam on using the Java input or the ``Scanner`` or ``Console`` classes, learning how to do input in Java is very useful and fun. For more information on using the ``Scanner`` class, go to https://www.w3schools.com/java/java_user_input.asp, and for the newer ``Console`` class, https://howtodoinjava.com/java-examples/console-input-output/. We are limited with the one way communication with the Java server in this Runestone ebook, but in most IDEs, the input/output would be more interactive. You can try this |JavaIOExampleJuiceMind| (click on Create Starter Code after login with a Google account) or |JavaIOExampleReplit| using the ``Scanner`` class and |JavaIOConsoleReplit| using the ``Console`` class.
234
238
235
239
236
240
@@ -644,7 +648,11 @@ In this programming challenge, you will calculate your age, and your pet's age f
Your teacher may suggest that you use a Java IDE like |repl| for this challenge so that you can use input to get these values using the |Scanner|. Here is a |repl template| that you can use to get started if you want to try the challenge with input.
Your teacher may suggest that you use a Java IDE like |repl| for this challenge so that you can use input to get these values using the |Scanner|. Here is a |repl template| that you can use to get started if you want to try the challenge with input.
Your teacher may suggest that you use a different Java IDE for this challenge so that you can use input to get these values using the |Scanner|, for example with this |JuiceMind template| or |repl template| that you can use if you want to try the challenge with input.
@@ -163,13 +163,17 @@ Intro to Objects with Turtles
163
163
164
164
The Turtle class (that we've written for you and hidden on this page) is a blueprint for turtle objects. It defines attributes for graphical turtles like their color and position and methods to make the turtles move. Try the Java program below that creates a Turtle object called yertle using the Turtle class.
Try clicking the run button below to see what the following program does.
172
-
(If the code below does not work or is too slow in your browser, you can also see the ``Turtle`` code in action at this |repl link| (refresh page after forking and if it gets stuck) or download the files |github| to use in your own IDE.)
176
+
(If the code below does not work or is too slow in your browser, you can also see the ``Turtle`` code in action on |JuiceMind| or |replit| or download the files |github| to use in your own IDE.)
@@ -150,7 +154,7 @@ There is another ``Turtle`` constructor that places the turtle at a certain (x,y
150
154
151
155
Try changing the code below to create a ``World`` object with 300x400 pixels. Where is the turtle placed by default? What parameters do you need to pass to the ``Turtle`` constructor to put the turtle at the top right corner? Experiment and find out. What happens if you mix up the order of the parameters?
152
156
153
-
(If the code below does not work in your browser, you can also use the ``Turtle`` code at this |repl link| (refresh page after forking and if it gets stuck) or download the files |github| to use in your own IDE.)
157
+
(If the code below does not work in your browser, you can also use the ``Turtle`` code on |JuiceMind| or |replit| or download the files |github| to use in your own IDE.)
Copy file name to clipboardExpand all lines: _sources/Unit2-Using-Objects/topic-2-3-methods-no-params.rst
+7-4Lines changed: 7 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,7 +72,6 @@ Every method call is followed by parentheses. The parentheses ``()`` after metho
72
72
73
73
74
74
After you put the mixed up code in order above, type in the same code below to make the turtle draw a 7.
75
-
(If the code below does not work for you, you can also use the ``Turtle`` code at this |repl link| (refresh page after forking and if it gets stuck) or download the files |github| to use in your own IDE.)
76
75
77
76
.. activecode:: TurtleDraw7
78
77
:language: java
@@ -371,7 +370,7 @@ Before you call a method from ``main`` or from outside of the current class, you
371
370
|Groupwork| Programming Challenge : Draw a Letter
372
371
-------------------------------------------------
373
372
374
-
Working in pairs, use the area below (or the |repl link|) to use a turtle to draw a simple block-style letter or number that uses just straight lines (no curves or diagonals). It could be one of your initials or a number from today's date.
373
+
Working in pairs, use the area below (or on |JuiceMind| or |replit|) to use a turtle to draw a simple block-style letter or number that uses just straight lines (no curves or diagonals). It could be one of your initials or a number from today's date.
375
374
376
375
It may help to act out the code pretending you are the turtle. Remember that which way you turn depends on which direction you are facing, and the turtle begins facing north (towards the top of the page).
377
376
@@ -384,9 +383,13 @@ Here are some simple turtle methods that you can use:
You may notice that it is challenging to have your turtle draw with these simple methods. In the next lesson, we will use more complex ``Turtle`` methods where you can indicate how many steps to take or what angle to turn that will make drawing a lot easier!
Copy file name to clipboardExpand all lines: _sources/Unit2-Using-Objects/topic-2-4-methods-with-params.rst
+9-4Lines changed: 9 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -124,7 +124,7 @@ different **method signature**, where it requires a different number or type of
124
124
125
125
|CodingEx| **Coding Exercise**
126
126
127
-
(If the code below does not work in your browser, you can also use the Turtle code at this |repl link| (refresh page after forking and if it gets stuck) or download the files |github| to use in your own IDE.)
127
+
(If the code below does not work in your browser, you can also use the Turtle code in |JuiceMind| or |replit| or download the files |github| to use in your own IDE.)
128
128
129
129
130
130
.. activecode:: TurtleTestMethods1
@@ -462,7 +462,7 @@ Try this |visualization| to see this code in action.
462
462
:align:left
463
463
:alt:simple house
464
464
465
-
This creative challenge is fun to do collaboratively in pairs. Design a house and have the turtle draw it with different colors below (or with this |repl link|). Can you add windows and a door? Come up with your own house design as a team.
465
+
This creative challenge is fun to do collaboratively in pairs. Design a house and have the turtle draw it with different colors below (or on |JuiceMind| or |replit|). Can you add windows and a door? Come up with your own house design as a team.
466
466
467
467
To draw a window, you will need to call ``penUp`` to walk the turtle into position, for example:
468
468
@@ -474,9 +474,14 @@ To draw a window, you will need to call ``penUp`` to walk the turtle into positi
474
474
475
475
It may help to act out the code pretending you are the turtle. Remember that the angles you turn depend on which direction you are facing, and the turtle begins facing up.
Copy file name to clipboardExpand all lines: _sources/Unit2-Using-Objects/topic-2-6-strings.rst
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -396,24 +396,25 @@ What if you wanted to print out a double quote " character? Since the double quo
396
396
397
397
Have you ever played MAD LIBS? In this game, you first choose a bunch of words without looking at the story and then those words are filled into the story to make it sound very wacky! Fill in the variables below with Strings for each word, and then run to see the wacky story.
Then, working in pairs, come up with another silly story that uses at least 5 new String variables. When you're done, try another team's mad libs code. Your teacher may ask you to create this program in a Java IDE like |repl| so that you can use input to read in the words (see input examples using the |Scanner|).
410
+
Then, working in pairs, come up with another silly story that uses at least 5 new String variables. When you're done, try another team's mad libs code. Your teacher may ask you to create this program in a Java IDE that can do input for example this coding exercise on |JuiceMind| using the |Scanner| to read in input into the variables.
410
411
411
412
.. activecode:: challenge2-6-MadLibs
412
413
:language: java
413
414
:autograde: unittest
414
415
:practice: T
415
416
416
-
If you used replit.com for this challenge, copy the url of your repl here to turn in.
417
+
Replace the nulls below with silly words to create a silly poem. Run the code to see the poem. Then, create your own silly story using 5 more String variables.
Copy file name to clipboardExpand all lines: _sources/Unit2-Using-Objects/topic-2-7-string-methods.rst
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -446,16 +446,16 @@ Here is a list of common mistakes made with Strings.
446
446
447
447
Create a program that takes a word and transforms it to Pig Latin using String methods. You may need the word's length, a substring that does not include the first letter, and a substring that is just the first letter (you can get the ith letter of a string using substring(i,i+1) so for example the letter at index 3 would be substring(3,4)).
Your teacher may ask you to create this program in a Java IDE like |repl| so that you can use input to read in the word (see input examples using the |Scanner|).
458
+
Your teacher may ask you to create this program in a Java IDE that can use input to read in the word, for example in |JuiceMind| using the |Scanner|.
You can also run a version of the |Magpie lab on replit.com| that uses the Scanner class for input so that you can type in your own input to interact with it.
You can also run a version of the Magpie lab on |JuiceMind| or |replit| that uses the Scanner class for input so that you can type in your own input to interact with it.
207
211
208
212
As you can see the ``getResponse`` method of Magpie2 looks for certain keywords like ``"mother"`` and ``"brother"``. Why do you think the response to "Do you know my brother?" isn't "Tell me more about your family."? Discuss this with partner in pairs and see if you can figure it out.
209
213
@@ -248,9 +252,7 @@ Alter the code above or in your own IDE (see section below) to do the following.
248
252
Activity 2: Actual Code - (Optional)
249
253
-------------------------------------
250
254
251
-
You can do all of Activity 2 with the actual code using the Scanner class for input instead if you prefer.
252
-
253
-
Here is the actual code for the |Magpie lab on replit.com|. It uses the ``Scanner`` class to read input from the user. The ``Scanner`` class is not on the AP CSA exam. You can log in to replit.com and use this code and change it to do this lab.
255
+
You can do all of Activity 2 with the actual code using the Scanner class for input instead if you prefer. The ``Scanner`` class is not on the AP CSA exam. You can use |JuiceMind| or |replit| online.
254
256
255
257
Or you can copy and paste in the code from below into any Integrated Development Environment (IDE) like DrJava or JGrasp to run on your computer.
0 commit comments