5-oct-15 introduction and code. overview in this presentation we will discuss: what is jeroo? where...
TRANSCRIPT
![Page 1: 5-Oct-15 Introduction and Code. Overview In this presentation we will discuss: What is Jeroo? Where can you get it? The story and syntax of Jeroo How](https://reader036.vdocument.in/reader036/viewer/2022062321/56649e885503460f94b8d37f/html5/thumbnails/1.jpg)
Apr 19, 2023
Introduction and Code
![Page 2: 5-Oct-15 Introduction and Code. Overview In this presentation we will discuss: What is Jeroo? Where can you get it? The story and syntax of Jeroo How](https://reader036.vdocument.in/reader036/viewer/2022062321/56649e885503460f94b8d37f/html5/thumbnails/2.jpg)
Overview
In this presentation we will discuss: What is Jeroo? Where can you get it? The story and syntax of Jeroo How to create islands, write code and run programs. Your first assignments.
![Page 3: 5-Oct-15 Introduction and Code. Overview In this presentation we will discuss: What is Jeroo? Where can you get it? The story and syntax of Jeroo How](https://reader036.vdocument.in/reader036/viewer/2022062321/56649e885503460f94b8d37f/html5/thumbnails/3.jpg)
What is Jeroo?
An environment for learning object oriented programming in Java, Basic or Python. (OOP). you create objects and then do things with them.
Created in Java. It’s free. www.jeroo.org
![Page 4: 5-Oct-15 Introduction and Code. Overview In this presentation we will discuss: What is Jeroo? Where can you get it? The story and syntax of Jeroo How](https://reader036.vdocument.in/reader036/viewer/2022062321/56649e885503460f94b8d37f/html5/thumbnails/4.jpg)
The story behind Jeroos
Jeroos similar to the wallabies of Australia have a pouch to hold flowers Winsum Flower: Jeroo's source of food
Where they live: Santong Island in the South Pacific can't swim – fur gets waterlogged-must dry
Humans arrive and set nets to catch Jeroos. Jeroos try to avoid the nets
![Page 5: 5-Oct-15 Introduction and Code. Overview In this presentation we will discuss: What is Jeroo? Where can you get it? The story and syntax of Jeroo How](https://reader036.vdocument.in/reader036/viewer/2022062321/56649e885503460f94b8d37f/html5/thumbnails/5.jpg)
The Jeroo environment
The island is made of rows and columns. Locations are written ( row, column) The programmer chose to number both the rows and columns
starting with zero at the northwest corner of the island.
(0,0) (0,1)
(?)
(3,2)
NORTH
What location is this?
columns
rows 0
1
2
3
0 1 2 3 4
![Page 6: 5-Oct-15 Introduction and Code. Overview In this presentation we will discuss: What is Jeroo? Where can you get it? The story and syntax of Jeroo How](https://reader036.vdocument.in/reader036/viewer/2022062321/56649e885503460f94b8d37f/html5/thumbnails/6.jpg)
What a Jeroo can do
A Jeroo can execute 6 action methods
1. hop() hop once or hop(n) to hop n times
2. turn(relative_direction )
3. pick() pick a flower
4. plant() plant a flower from the pouch
5. toss() throw a flower 1 space ahead.
6. give(relative direction) give a flower to another Jeroo
They always follow directions in order, from top to bottom.
Put it all together to solve various problems.
Four relative directions: LEFT RIGHT AHEAD HERE
When you turn or give, you must specify a relative directionturn(relative_direction ) give(relative direction)
![Page 7: 5-Oct-15 Introduction and Code. Overview In this presentation we will discuss: What is Jeroo? Where can you get it? The story and syntax of Jeroo How](https://reader036.vdocument.in/reader036/viewer/2022062321/56649e885503460f94b8d37f/html5/thumbnails/7.jpg)
Creating a program in Jeroo
3 steps:1. Create the environment
2. Write the program
3. Run the program
![Page 8: 5-Oct-15 Introduction and Code. Overview In this presentation we will discuss: What is Jeroo? Where can you get it? The story and syntax of Jeroo How](https://reader036.vdocument.in/reader036/viewer/2022062321/56649e885503460f94b8d37f/html5/thumbnails/8.jpg)
Step 1. Create the Environment
To start: Open an existing Island File Or Create your own Island
Add or remove: Flowers Nets Water
Be careful, this one is different: it resets the island Land
You can save and re-use your islands.
![Page 9: 5-Oct-15 Introduction and Code. Overview In this presentation we will discuss: What is Jeroo? Where can you get it? The story and syntax of Jeroo How](https://reader036.vdocument.in/reader036/viewer/2022062321/56649e885503460f94b8d37f/html5/thumbnails/9.jpg)
Creating the Jeroo environment
To create your environment in Jeroo:
Left-click to draw
Right-click to remove
![Page 10: 5-Oct-15 Introduction and Code. Overview In this presentation we will discuss: What is Jeroo? Where can you get it? The story and syntax of Jeroo How](https://reader036.vdocument.in/reader036/viewer/2022062321/56649e885503460f94b8d37f/html5/thumbnails/10.jpg)
Step 2. Write the program
You can create and control up to 4 Jeroos.
Your program must have a main method
{ curly braces } surround statements to group them together
In Java every statement ends with a ; semicolon
Each Jeroo gets a name when it is created
![Page 11: 5-Oct-15 Introduction and Code. Overview In this presentation we will discuss: What is Jeroo? Where can you get it? The story and syntax of Jeroo How](https://reader036.vdocument.in/reader036/viewer/2022062321/56649e885503460f94b8d37f/html5/thumbnails/11.jpg)
The constructor statement
Jeroo alfred = new Jeroo(); A new Jeroo is created and assigned the name alfred. alfred will appear in the top left corner of the island, facing
east.
All statements in the main program must specify which Jeroo is to act, and what it is to do. alfred.toss(); tells alfred to toss a flower into the space ahead.
![Page 12: 5-Oct-15 Introduction and Code. Overview In this presentation we will discuss: What is Jeroo? Where can you get it? The story and syntax of Jeroo How](https://reader036.vdocument.in/reader036/viewer/2022062321/56649e885503460f94b8d37f/html5/thumbnails/12.jpg)
Coding practice
Write the code to create a new Jeroo named neo
Write the code to make neo hop
Write the code to make neo turn right.
Answers:
•Jeroo neo = new Jeroo();
•neo.hop( );
•neo.turn(RIGHT);
![Page 13: 5-Oct-15 Introduction and Code. Overview In this presentation we will discuss: What is Jeroo? Where can you get it? The story and syntax of Jeroo How](https://reader036.vdocument.in/reader036/viewer/2022062321/56649e885503460f94b8d37f/html5/thumbnails/13.jpg)
hopping hop() alone means hop once in the direction the Jeroo is facing
hop(n) will tell the Jeroo to hop n times
Example: alexandria.hop(3);
is the same as: alexandria.hop(); alexandria.hop(); alexandria.hop();
Write the code to make neo hop forward 5 times .• neo.hop(5);
![Page 14: 5-Oct-15 Introduction and Code. Overview In this presentation we will discuss: What is Jeroo? Where can you get it? The story and syntax of Jeroo How](https://reader036.vdocument.in/reader036/viewer/2022062321/56649e885503460f94b8d37f/html5/thumbnails/14.jpg)
Step 3: Run the program
Animation shows Jeroos moving around the island Source code highlights while executing You can run one step at a time Run the whole program continuously Pause at any time Go back to the beginning, or stop
![Page 15: 5-Oct-15 Introduction and Code. Overview In this presentation we will discuss: What is Jeroo? Where can you get it? The story and syntax of Jeroo How](https://reader036.vdocument.in/reader036/viewer/2022062321/56649e885503460f94b8d37f/html5/thumbnails/15.jpg)
Step 3: Run the program
3 different language modes
You want Java/C++/C#
![Page 16: 5-Oct-15 Introduction and Code. Overview In this presentation we will discuss: What is Jeroo? Where can you get it? The story and syntax of Jeroo How](https://reader036.vdocument.in/reader036/viewer/2022062321/56649e885503460f94b8d37f/html5/thumbnails/16.jpg)
Watch a program running
the code is highlighted the Jeroo acts
![Page 17: 5-Oct-15 Introduction and Code. Overview In this presentation we will discuss: What is Jeroo? Where can you get it? The story and syntax of Jeroo How](https://reader036.vdocument.in/reader036/viewer/2022062321/56649e885503460f94b8d37f/html5/thumbnails/17.jpg)
Find the logic errors
Go to Jeroo and demonstrate and fix alexandria
![Page 18: 5-Oct-15 Introduction and Code. Overview In this presentation we will discuss: What is Jeroo? Where can you get it? The story and syntax of Jeroo How](https://reader036.vdocument.in/reader036/viewer/2022062321/56649e885503460f94b8d37f/html5/thumbnails/18.jpg)
Lab 1
Start Jeroo Enter your name 1. Create the environment
Clear the island layout. Place a flower at location Row 3 Column 2
2. Write the program Create a Jeroo with your name Tell it to hop to the flower Tell it to pick the flower
3. Run the program If it doesn’t work, fix it!
![Page 19: 5-Oct-15 Introduction and Code. Overview In this presentation we will discuss: What is Jeroo? Where can you get it? The story and syntax of Jeroo How](https://reader036.vdocument.in/reader036/viewer/2022062321/56649e885503460f94b8d37f/html5/thumbnails/19.jpg)
The program goes in the main method
Create a Jeroo with your name Jeroo mrsOC = new Jeroo( );
It will appear in location 0,0 facing EAST with no flowers in its pouch.
Tell it to hop onto the location with the flower mrsOC.hop( );
You must address your Jeroo by name. repeat this statement each time you want your Jeroo to hop
mrsOC.turn (relative direction); You must turn either LEFT or RIGHT
Tell it to pick the flower mrsOC.pick( );
It will stop when it reaches the end of the program.
![Page 20: 5-Oct-15 Introduction and Code. Overview In this presentation we will discuss: What is Jeroo? Where can you get it? The story and syntax of Jeroo How](https://reader036.vdocument.in/reader036/viewer/2022062321/56649e885503460f94b8d37f/html5/thumbnails/20.jpg)
Icons used to create and edit islands• Set the speed of the Jeroos• Create a new island layout• Open an existing island
• Save the island• Save as• Print• Plant flowers on the island
• Set nets on the island• Add water to the island• Clear the island layout (remove all
extra flowers, water and nets)• Get help with the Jeroo language
• Quit Jeroo
![Page 21: 5-Oct-15 Introduction and Code. Overview In this presentation we will discuss: What is Jeroo? Where can you get it? The story and syntax of Jeroo How](https://reader036.vdocument.in/reader036/viewer/2022062321/56649e885503460f94b8d37f/html5/thumbnails/21.jpg)
Learn how to create islands.
Select water, flower or net
•left-click to add
•right-click to remove
Learn how to save islands.
Programs and islands are saved separately
•Source_file save (.jsc)
•Island_file save (.jev)
First Assignment
Create an attractive island based on your initials using water, land, flowers and nets.
![Page 22: 5-Oct-15 Introduction and Code. Overview In this presentation we will discuss: What is Jeroo? Where can you get it? The story and syntax of Jeroo How](https://reader036.vdocument.in/reader036/viewer/2022062321/56649e885503460f94b8d37f/html5/thumbnails/22.jpg)
Top Grade
Write a program to get a Jeroo from one end of your original letter island to the other using AT LEAST 8 programming steps.
Add a comment to your code with your name in it and print the code.
(comments start with //)
![Page 23: 5-Oct-15 Introduction and Code. Overview In this presentation we will discuss: What is Jeroo? Where can you get it? The story and syntax of Jeroo How](https://reader036.vdocument.in/reader036/viewer/2022062321/56649e885503460f94b8d37f/html5/thumbnails/23.jpg)
The End