370 likes | 513 Views
Using Jeroo Dianne Meskauskas. Overview. In this presentation we will discuss: What is Jeroo? Where did it come from? Why use it? How it works. Your first assignments. What is Jeroo?. An environment for learning object oriented programming. (OOP)
E N D
Overview • In this presentation we will discuss: • What is Jeroo? • Where did it come from? • Why use it? • How it works. • Your first assignments.
What is Jeroo? • An environment for learning object oriented programming. (OOP) • The Jeroo language is a small object-oriented programming language. • you create objects and then do things with them. • Created in Java.
Essential Concepts • Program– a set of instructions for the computer • Source Code – a program written by a programmer in a programming language • Compiler – translates a program (or class) as a whole into another form such as byte code or machine code • Interpreter – translates a program into machine language one statement at a time • Java Byte Code – intermediate language created by the Java compiler. The JVM translates byte code into machine code. • Machine Code – program in the form of binary codes - a series of 1’s and 0’s - that are understandable by the computer’s CPU
Essential Concepts • Algorithm – a plan for solving a problem • Syntax – a set of rules for writing or speaking a language • Semantics – the meaning associated with valid expressions
Essential Concepts - OOP • Object – represents a specific concept or item that is relevant to a problem to be solved. There are two parts to an object, facts about the object and tasks it can perform. • Attribute – is a fact associate with a specific object • Behavior – is an action an object can perform in response to a request from an external source
Essential Concepts - OOP • Method – a collection of statements that are written in some programming language to describe a specific behavior • Method Precondition – something that is assumed to be true before the method is invoked • Method Postcondition – something that is assumed to be true after the method has been executed
Essential Concepts - OOP • Message – a request for a specific object to perform a specific taskWhen we ask an object to perform a task (behavior), we are sending a message to the object or invoking the method that describes the task.
Essential Concepts - OOP • Class – is a collection of statements that are written in some programming language to describe both the attributes and the behaviors of an object. • Instantiation – the process of creating a specific object.Jeroo clyde = new Jeroo();clydeis an instance of the Jeroo class.
Where did Jeroo come from? • NW Missouri State University • Used in introductory college programming classes. • Under development • It’s free. www.jeroo.org
Why use Jeroo? • Jeroo keeps the focus on important topics. • Students master ideas faster. • Jeroo stimulates problem solving. • Jeroo encourages experimentation. • It’s fun!
Jeroo • Place: Santong Island in the South Pacific • Two unknown species • Jeroo: similar to the wallabies of Australia • Winsum Flower: Jeroo's source of food • Jeroos • have a pouch to hold flowers • can't swim – fur gets waterlogged-must dry • Humans arrive and set nets to catch Jeroos.
The Jeroo environment • The island is made of rows and columns. • The programmer chose to number both the rows and columns starting with zero at the northwest corner of the island. NORTH What location is this?
Programming steps • 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 one 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.
How Jeroo works • 3 steps: • Create your environment • Write the program • Run the program
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
Step 1. Create the Environment • To start: • Open an existing Island File • Or Create your own Island • Add or remove: • Flowers • Nets • Water • Land • You can save and re-use your islands.
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)
A video demonstrating the Jeroo environment To create your environment in Jeroo: Left-click to draw Right-click to remove (click the link below) Start the video
Your first island: Assignment • Design an island that uses water, nets and flowers to create an attractive design based on one or more of your initials. • Click the floppy disk on the island side and save as yournameLetterIsland1 to your folder by clicking the down arrow for Save in and choosing the Thawspace (T:) and double clicking the lower case: wbhs-lab6105 (middle) and double clicking My Documents folder and double clicking your folder. • Print your island design. Now try to make the rest of your initials yournameLetterIsland2 and 3
The End • Staple the fill in the blank sheet on top of your print out. • With the rubric
Overview • In this presentation we will discuss: • How to write code in Jeroo • How to run a Jeroo program
Review: Step 1. Create the Environment • To start: • Open an existing Island File • Or Create your own Island • Add or remove: • Flowers • Nets • Water • Land • You can save and re-use your islands.
Step 2. Write the program • You can create and control up to 4 Jeroos. • Your program must have a main method • Each Jeroo gets a name when it is created • Refer to them by name to send them a message
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.
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);
Choosing directions • Four relative directions • LEFT • RIGHT • AHEAD • HERE • Four compass directions • NORTH • SOUTH • EAST • WEST When you turn, you must specify a relative direction
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);
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
Watch a program running • the code is highlighted • the Jeroo acts • Click the link to see demonstration of A Jeroo program running continuously
Step 3: Run the program • 3 different language modes • You want Java/C++/C#
Find the logic errors Go to Jeroo and create a flower at 3,2. (left click to create a flower, right-click to erase a flower) Type the commands exactly as you see them then run the program to find the errors Save it as Your Initials Alexandria to your folder
Your First Program • Start Jeroo • Enter your name • 1. Create the environment • Clear the island layout. • Place a flower at location Row 12 Column 12 • 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!
The program goes in the main method • Create a Jeroo with your name • Jeroo mrsH = 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 • mrsH.hop( ); • You must address your Jeroo by name. • repeat this statement each time you want your Jeroo to hop mrsH.turn (relative direction); • You must turn either LEFT or RIGHT • Tell it to pick the flower: the Jeroo must be ontop of the flower to pick it • mrsH.pick( ); • It will stop when it reaches the end of the program.
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. • Save the program as yourNameLetterIsland (the programming code will be saved with .jsc for jeroo source code as the extension. The island will be saved with .jev for jeroo environment as the extension so it is safe to name the island the program with the same name)