Category Archives: Jeroo

Assignments and posts involving Jeroo.

String 1 and Array 1 Exercises

Exercises for String 1 and Array 1 (no loops)

When you are done, you can copy and past the score() method below into your class. It will test some (but, by no means all) of the things that your code should do

Create a class called StrArr1 and add each method below into it.

For the absVals()  method below use the Math.abs() Java method.

For the  randos1to10()   method below use the  Math.random()  Java method. Create a new array to store random integers. Each integer should be [1,10]

Systematically Visit [python]

Parameters

• 1 while loop
• visit all cells that you can
• pick up all flowers
• your loop must terminate (ie your Jeroo cannot keep going around the field forever)

Map #1

• start in (0,0) with 625 flowers!
• row by row, plant flowers until you to position (23,0) as shown in animation below.

D:\My Drive\2021-22_gdrive\intro 2021-22\jeroo\maps-student\unit-5

The Maps

Note: Do not be fooled by how similar the next map is. You will probably have to rewrite some code to complete the next one.

Grade : 9/10  (THE FIRST MAP THAT *MUST* BE SHOWN)

Want an “A”, you must do the following map

Extra credit:

climb-the-stairs-[python]

Climb The Stairs

For all these maps:

• Start your jeroo in the bottom left , at 23,0
• use 1 and only 1 while loop
• you may only hop() 1 space at a time
• pick the flower at the end.

climb-the-stairs__1.jev

climb-the-stairs__2.jev

climb-the-stairs__3.jev

climb-the-stairs__4.jev

climb-the-stairs__5.jev

climb-the-stairs__6.jev

climb-the-stairs__9.jev

**( Only if you want to get that ‘A’)

Jeroo in Python — while loop vs if test

The main difference between an “if” test and a “while ”

While Loops

Happens many times (as long as the test is true)

Happens 1 time

Traversing the Rim

In the prior assignment (#2b), you were asked to go around the inner lake  as shown  below. We are going to add 1 new requirement to this

• with a flower in 6,6
• using while loop(s) traverse around the border of the inner lake
• For each map, you should pick the flower, after the loop is over

What is new this time?

• You are forced to use 1 and only 1 while loop .
• you can only use hop() (ie you can’t hop more than 1 space)
• after the loop is done , then you can   pick()  the flower

recangular-lake.jev

recangular-lake-if2.jev

Scroll down for a hint about how to handle if test #1 for this map.

A closerlook at if test #1 (how to get around that first if test)

rectangular-lake-bumps1.jev

recangular-lake-bump3A.jev

recangular-lake-bump3B.jev ( NOT BEING GRADED, SKIP THIS)

walk-the-lake-jacks-map.jev

Write an infinite loop (1 while loop). You may NOT use isWater()

Cross The bridge Custom Method 1

Objective: Your goal is get your jeroo onto the right side of the island. Note that the red areas are nets. You must toss() a flower onto the net before you can go on the net.. You will need the following island file .

The first time that we did this our code looked like this .

#1)However, we want to create the following custom method custom_method .

#2) Then our “main Section” code should be changed to:

#2 A

Create the map below

• with a flower in 0,0
• Jeroo to its right (0,1)
• using while loop(s) traverse around the border of the island
• at the end pick the flower
• you can only use hop() (ie you can’t hop more than 1 space)

#2 B

Create the map below

• Jeroo to its right (6,6)
• use multiple while loops
• at the end pick the flower
• you can only use hop() (ie you can’t hop more than 1 space)

rectangular-lake.jev

1) Starting
<

2) Go around lake, until you are in front of the flower

3) Then pick the flower

While loop with if test

Let’s write a program that solves the map below (which you should create yourself) using only 1 while loop

What is an “If Test”?

If you just want to do a single test, use an ‘if’ test, instead of a while loop

…Now we can continue hopping till we get to the end of the map

Your Assignment: Create the map above and complete the program . All that you have to do use is the code at the top and then write the custom method goRoundWater()

The Betrothal

Tom and Tammy are in love, and today’s the day that Tom is going to propose. According to custom, Tom must present Tammy with a flower as an official sign of his intentions. Tom lives in the extreme northwest corner of the island, and Tammy lives in the extreme northeast corner. The dividing river runs north and south, dividing the island roughly in the middle; the river is at least 5 cells away from the western and eastern edges of the island. The river, itself, is exactly two cells wide. Fortunately, for the lovers, there is a bridge somewhere to the south of their homes. Tom has asked Tammy to meet him at the middle of the bridge. While she suspects his motives, she doesn’t want to appear too anxious. The purpose of this program is to have Tom and Tammy find the bridge and meet in the middle where Tom will give an engagement flower to Tammy. After he has given her the flower, each returns to its home and faces the home of its betrothed. Each Jeroo starts at its home, Tom at (0,0) and Tammy at (0,23). Each can start facing any direction. Tom starts with one special flower in his pouch. A representative starting layout is shown in figure 1

Walk-the-lake

Monsoon rains have created a lake in the middle of Santong Island.  Furthermore, that lake contains an island. Two Jeroos were separated by the rains.  One is on the main part of Santong Island, but the other is on the island in the middle of the lake.  The goal of this program is to have each Jeroo explore the shoreline of the lake.

• Each Jeroo starts with one flower and the lake immediately to its right.
• Each Jeroo starts by planting a flower then traveling, keeping the lake on its right, until it returns to the flower. The Jeroo then picks the flower.
• (only plant 1 flower, at starting point…and make 1 lap until you are back at that flower)
• Have the Jeroo on the main part of Santong Island walk the shore first.
• then have the one on the lake’s island walk the shore

Acknowledgement

This problem is adapted from one that was created originally by Erica Eddy of The University of Wisconsin – Parkside.

Or you can try walk the lake using loops using this map and Jeroo assignment