Computer programming with murtle the turtle
This presentation is the property of its rightful owner.
Sponsored Links
1 / 23

computer programming with murtle the turtle PowerPoint PPT Presentation


  • 217 Views
  • Updated On :
  • Presentation posted in: General

computer programming with murtle the turtle. a program is a set of instructions. that tells a computer what to do. java is a programming language. java is object-oriented. an object is a thing,. like a cookie. an object belongs to a class . a class is like a cookie-cutter.

Related searches for computer programming with murtle the turtle

Download Presentation

computer programming with murtle the turtle

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Computer programming with murtle the turtle

computer programming with murtle the turtle


Computer programming with murtle the turtle

a program is a set of instructions

that tells a computer what to do.


Computer programming with murtle the turtle

java is a programming language.

java is object-oriented.


Computer programming with murtle the turtle

an object is a thing,

like a cookie.


Computer programming with murtle the turtle

an object belongs to a class.

a class is like a cookie-cutter.


Computer programming with murtle the turtle

how many cookies can you make

with one cookie-cutter?


Computer programming with murtle the turtle

objects can do things.

drive

?

?

park

turn

?

methods define what an object can do.


Computer programming with murtle the turtle

meet murtle.

murtle is an object.


Computer programming with murtle the turtle

murtle belongs to the GTurtle class.

GTurtle

murtle

yurtle

harry


Computer programming with murtle the turtle

create murtle.

GTurtle murtle = new GTurtle();


Computer programming with murtle the turtle

murtle lives in a window.


Computer programming with murtle the turtle

add murtle to the window.

0

100

200

300

400

100

200

300

add(murtle);


Computer programming with murtle the turtle

See murtle appear.

  • Press Ctrl+1 to compile your code

    • If you see an error message

      • Double-click on the first line of the error to return to the code.

      • See if you can correct the problem.

        • Pay attention to spelling and upper/lower case!

      • Try to compile again (Ctrl+1)

      • Continue until you see no more errors.

  • Press Ctrl+3 to run your program


Computer programming with murtle the turtle

murtle has methods,

see murtle grow.

murtle.setSize(50);

see murtle spin.

murtle.right(360);

see murtle move.

murtle.forward(100);

so she can do things.


Computer programming with murtle the turtle

see murtle move.

0

100

200

300

400

100

Don’t forget!Ctrl+1 to compileCtrl+3 to run

200

300

murtle.setLocation(200, 150);


Computer programming with murtle the turtle

see murtle draw.

murtle.penDown();

murtle.forward(100);


Computer programming with murtle the turtle

see murtle turn.

90o

180o

0o

270o

murtle.right(90);


Computer programming with murtle the turtle

Can you make murtle draw a square?


Computer programming with murtle the turtle

murtle gets colorful.

Built-in colors:

BLACK

BLUE

CYAN

GRAY

GREEN

MAGENTA

ORANGE

PINK

RED

WHITE

YELLOW

murtle.setColor(Color.BLUE);


Computer programming with murtle the turtle

murtle gets loopy!

  • Draw a square

  • //Draw a square

  • for (int j = 1; j <= 4; j++)

  • {

  • murtle.forward(100);

  • murtle.right(90);

  • }

  • 2. How would you change the loop to draw:

    • a pentagon?

    • a hexagon?

    • an octagon?


Computer programming with murtle the turtle

murtle gets loopier!

//Draw a bunch of squares

for (int i = 0; i < 36; i++)

{

//Draw a square

for (int j = 0; j < 4; j++)

{

murtle.forward(80);

murtle.right(90);

}

murtle.right(10);

}


Computer programming with murtle the turtle

goodbye murtle!


  • Login