1 / 23

Introduction and Code

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 to create islands, write code and run programs. Your first assignments. What is Jeroo?.

bkeefe
Download Presentation

Introduction and Code

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction and Code

  2. 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.

  3. 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

  4. 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

  5. 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. 2 0 1 3 4 columns 0 rows 1 NORTH 2 3 What location is this?

  6. What a Jeroo can do • A Jeroo can execute 6 action methods • hop() hop once or hop(n) to hop n times • turn(relative_direction ) • pick()  pick a flower • plant()  plant a flower from the pouch • toss()  throw a flower 1 space ahead. • give(relativedirection)  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 direction turn(relative_direction ) give(relativedirection)

  7. Creating a program in Jeroo • 3 steps: • Create the environment • Write the program • Run the program

  8. 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.

  9. Creating the Jeroo environment To create your environment in Jeroo: Left-click to draw Right-click to remove

  10. 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

  11. 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.

  12. 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. Coding practice Answers: • Jeroo neo = new Jeroo(); • neo.hop( ); • neo.turn(RIGHT);

  13. 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);

  14. 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

  15. Step 3: Run the program • 3 different language modes • You want Java/C++/C#

  16. Watch a program running • the code is highlighted • the Jeroo acts

  17. Find the logic errors Go to Jeroo and demonstrate and fix alexandria

  18. 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!

  19. 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.

  20. 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

  21. First Assignment Create an attractive island based on your initials using water, land, flowers and nets. • 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)

  22. 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 //)

  23. The End

More Related