Lecture 2. Review To play with Turtle, we need to download and install followings: 1.JDK 6 2.Dr. Java 3.Sample program (e.g. BookClass)

Slides:



Advertisements
Similar presentations
Computer Science 1000 LOGO I. LOGO a computer programming language, typically used for education an old language (1967) the basics are simple: move a.
Advertisements

Super Logo. Key Instructions Pendown penup Forward 50 ( this number can change) Right 90 ( this number can change as well) Now try and draw a Early finishers,
Faculty of Sciences and Social Sciences HOPE Structured Problem Solving Object Oriented Concepts 2 Stewart Blakeway FML 213
CS320n – Elements of Visual Programming Introduction to Alice Mike Scott (Slides 1-1)
11-Jun-15 Getting Ready for CIT Registering and labs If you are not yet registered (and want to be), be sure I have your name and student ID We.
1 Lecture Today’s Topics Classes –Attribute (variables) –Behaviors (methods) Using methods –How to write methods –How to use methods Scope –Private.
Lecture 3. Review (What is Class and Object ?) The world of JAVA contains objects The world of JAVA.
Installing JDK Vijayan Sugumaran Department of DIS Oakland University.
Lecture 6. What is the difference in pictures ???
Color (1) Turtle class contains a method to change the pen color Note: before using Color class, you should add following line in the top of the source.
Lesson One: The Beginning
13-Jul-15 Getting Ready for Java. 2 What You Need 256 MB of RAM (512 MB or more recommended) 500 MHz Pentium or better Macintosh: must run Mac OS X, preferably.
Methods Tutorial: Part One By Deborah Nelson Duke University Under the direction of Professor Susan Rodger June 9, 2008.
B.A. (Mahayana Studies) Introduction to Computer Science November March Logo (Part 1) An introduction to Logo: drawing, moving,
Getting Started with IBM Rational System Developer 01/06/2011.
01-Intro-Object-Oriented-Prog-Alice1 Barb Ericson Georgia Institute of Technology Aug 2009 Introduction to Object-Oriented Programming in Alice.
Getting Started With Java Downloading and installing software Running your first program Dr. DwyerFall 2012.
1 CSC 221: Computer Programming I Fall 2004 Objects and classes: a first pass  software objects, classes, object-oriented design  BlueJ IDE, compilation.
04-Intro-Object-Oriented-In-Java1 Barb Ericson Georgia Institute of Technology Sept 2009 Introduction to Object-Oriented Programming in Java.
Parts of a Computer Why Use Binary Numbers? Source Code - Assembly - Machine Code.
Fall CIS 764 Database Systems Engineering L3: Two Assignments Relating to J2EE.
Copyright ©: SAMSUNG & Samsung Hope for Youth. All rights reserved Tutorials Software: Building apps Suitable for: Advanced.
Servlets Environment Setup. Agenda:  Setting up Java Development Kit  Setting up Web Server: Tomcat  Setting up CLASSPATH.
Chapter 1.4 Programming languages Homework Due: Monday, August 11, 2014.
Ali Shahrokni Application Components Activities Services Content providers Broadcast receivers.
Introduction to Computers and Programming – Computer Programming.
Georgia Institute of Technology Barb Ericson Georgia Institute of Technology May 2006 Teaching Java using Turtles part 1.
Introducing Scratch the Cat
CSE 1001 & CSE 1002 STUDENT RESOURCES For JAVA Programming Development William Slavinsky.
( ) 1 ISYE 7210—Fall 2005 Design of Real-Time Interactive Simulations (in Java) Initial Notes Christine M. Mitchell Director & Professor Center for.
IDEs Department of Information Systems and Computer Science Ateneo de Manila University.
Introduction to Java CS1316: Representing Structure and Behavior.
How to Run a Java Program CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
Class 2 Introduction to turtle graphics
CS 101: Introduction to computer programming and utilization Abhiram Ranade.
Copyright © Curt Hill Turtles The beginning of media computation.
An introduction to Logo Mike Warriner Engineering Director, Google Note: This course is not an endorsement of Logo by Google. All views in this document.
Agenda For Feb PowerPoint Presentation (Introduction to Java Methods) 2.Finish Unit 2 exercises on page 13 (due by the end of the class today). 4.
Setting Up Eclipse. What is Eclipse? Eclipse is a free, downloadable software that allows us to create, compile, and run JAVA programs.
1 CSC 221: Computer Programming I Spring 2008 Objects and classes: a broad view  software objects, classes, object-oriented design  BlueJ IDE, compilation.
Java Introduction part 2 CSC1401. Overview In this session, we are going to examine some of the instructions from the previous class in more detail.
EIE375 BlueJ: Getting Started Dr Lawrence Cheung.
Installing JDK Vijayan Sugumaran Department of DIS Oakland University.
Java Methods Methods contain a group of instructions that together perform a single task. For example if I want to perform the task of “making a pizza”,
Tool Install How to download & install Java 6 & Eclipse updated version based on Dr. G. L. Ray’s slides.
Georgia Institute of Technology Simulations Barb Ericson Jan 2005.
Computer Science I Programming in Java (programming using Processing IN Java, using IntelliJ IDE) Classwork/Homework: copy your Processing projects over.
1 Installing Java on Your PC. Installing Java To develop Java programs on your PC: Install JDK (Java Development Kit) Add the directory where JDK was.
Georgia Institute of Technology Barb Ericson Georgia Institute of Technology Aug 2006 Introduction to Object-Oriented Programming in Alice and Java.
Introduction To Greenfoot
Course Overview, JDK & NetBeans BCIS 3680 Enterprise Programming.
1 Getting Started with C++ Part 1 Windows. 2 Objective You will be able to create, compile, and run a very simple C++ program on Windows, using Microsoft.
Let’s Learn 3. Modules Saenthong School, January – February 2016
Object and Classes อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา Chapter 3.
Turtle Graphics Let’s see what we can draw on Python!
Downloading a Visual C compilers (try it yourself at home) Visual Studio 2012 can be found at:
Turtle Graphics Lesson 2 1. There are 3 homeworks to complete during the six lessons of this unit. Your teacher will let you know when a homework has.
LOGO WHAT IS IT? HOW TO USE IT AND HOW USEFUL CAN IT BE?
What is it? How to use it and how useful can it be?
IBM Worklight environment setup 1. Eclipse IDE Multi-purpose integrated development environment (IDE) Open source Supported for Windows, Mac OS X, Linux.
Using the Python Turtle
More methods, more capabilities
An introduction to programming Created by Dr. Randy Pausch
Introduction to Object-Oriented Programming in Java
Teaching Java using Turtles part 1
How to Run a Java Program
Using Logo and Logic This presentation uses a version of Logo called StarLogo available through MIT. It can be downloaded for free and installed on your.
Review of Previous Lesson
Teaching Java using Turtles
The beginning of media computation Followed by a demo
Presentation transcript:

Lecture 2

Review To play with Turtle, we need to download and install followings: 1.JDK 6 2.Dr. Java 3.Sample program (e.g. BookClass)

JDK 6 Java Development Kit (version 6) –It contains several tools, required to write and test Java applications –You may download Windows Platform - Java(TM) SE Development Kit 6 Note: It is already installed in PC at computer lab

Dr. Java It is a software application, called IDE (Integrated Development Environment) –It supports us to develop an application –It provides GUI builder, a text/program editor, compiler, and debugger, etc. For example Visual Studio, JBuilder, FrontPage and DreamWeaver –You may download Windows App

Sample Program Sample program contains Java program, which enable us to play with Turtle –You may download bookClasses zip –You have to extract the zip file into a directory For example, you can create a directory named “BookClass”, and extract files into the directory

And then … After open Dr.Java, you have to tell Dr. Java where the sample program is 1 Select Edit -> Preference 2 Click Add and specify the directory of BookClass

Don’t forget Homework 0 –Be prepare for doing homework and projects at both computer lab and home !!!

Today Let’s talk about –Object –Class –Instance –Method –Statement

Creating objects World w1 = new World() Create a new world, named w1 - This creates a window whose size is 640x480 pixels

Creating objects Turtle t1 = new Turtle(w1) Create a turtle, named t1, in the world w1 - as a default, a turtle is located at the center where? (320, 240)

Creating objects World w1 = new World() World w2 = new World() Turtle t1 = new Turtle(w1) Turtle t2 = new Turtle(w2) Turtle t3 = new Turtle(w1) You can create many worlds and turtles W1W2 T1, T3T2

What is an object In real world –Dog, Book, Cell phone, etc. –Each object has a state and a behavior For example, Dog State – He has name, color, breed, etc. Behavior – He is barking, wagging, etc. –The world is viewed as a collection of objects Similarly, in Java programming world –Object contains data and operations For example, Turtle t1 has name (t1) and color (green), etc. can move, can turn, etc.

Class and Object For example of phone, there are many types of phones. To create “your phone” (which is an objects) we need a blueprint to create it. –Let’s call the blueprint PHONE The blueprint PHONE is called class In java, we say that “your phone” is an instance of class, known as PHONE PHONE

Class and Object Turtle Object 1 Turtle Object 2 Turtle: Class Class is like a cookie cutter Many objects are created from a class Using the new operator: ClassName name = new ClassName(); For example Turtle t1 = new Turtle(w1)

Methods of Turtle A Turtle has a pen A Turtle can take actions such as move and turn While a turtle moves, he draws a line with a pen In Java We call the actions as methods e.g. move forward, and backward, turn right and left, etc.

How to call method ObjectName.MethodName() For example, Turtle t1 = new Turtle(w1) t1.forward() t1.backward() t1.turnRight() t1.turnLeft() t1.forward(200) t1.turn(45) … ObjectName.MethodName(parameter)

Statement Each instruction is called a statement A program is a collection of statements Note: Please remember that semi-colon is required at the end of each statement World w1 = new World(); t1.turnLeft();

Lab –Let’s play with Turtle

Warming up!!! Try to draw a triangle

Practice!!! Try to draw a pentagon

Practice!!! Try to draw a pentagon x 3 / 5 =

Additional methods … penUp() - turtle will grab his pen up penDown() - turtle will put his pen down moveTo(x,y) - turtle will move to a position (x, y)

Additional methods … (more!!!) hide() - turtle will hide from the world show() - turtle will show up again clearPath() - clear all lines in the world note: you have to minimize the window setColor( java.awt.Color.xxx ) - turtle will change the pen color - xxx will be RED, BLUE, GREEN, etc

Challenge Try to draw one triangle and one square in the world