<< Chapter < Page Chapter >> Page >

What's next?

In the next module, I will teach you how to invert images and how to display images using Ericson's PictureExplorer object.

While not a requirement of the course, you can select the following links to view optional online video lectures on the material in thismodule.

Miscellaneous

This section contains a variety of miscellaneous information.

Housekeeping material
  • Module name: Java OOP: Creating and Manipulating Turtles and Pictures in a World Object
  • File: Java3002.htm
  • Published: 07/26/12
Disclaimers:

Financial : Although the Connexions site makes it possible for you to download a PDF file for thismodule at no charge, and also makes it possible for you to purchase a pre-printed version of the PDF file, you should beaware that some of the HTML elements in this module may not translate well into PDF.

I also want you to know that, I receive no financial compensation from the Connexions website even if you purchase the PDF version of the module.

In the past, unknown individuals have misappropriated copies of my modules from cnx.org, converted them to Kindle books, andplaced them for sale on Amazon.com showing me as the author. I receive no compensation for those sales and don't know who doesreceive compensation. If you purchase such a book, please be aware that it is a bootleg copy of a module that is freelyavailable on cnx.org.

Affiliation : I am a professor of Computer Information Technology at Austin Community College in Austin, TX.

Complete program listing

A complete listing of the program discussed in this module is shown in Listing 9 below.

Listing 9 . Source code for Prob01 .
/*File Prob01 Copyright 2008 R.G.Baldwin Command-line outputjavac 1.6.0_14 java version "1.6.0_14"Java(TM) SE Runtime Environment (build 1.6.0_14-b08)Java HotSpot(TM) Client VM (build 14.0-b16, mixed mode, sharing)Dick Baldwin. A 300 by 274 world with 2 turtles in it.joe turtle at 44, 143 heading -135.0. sue turtle at 250, 237 heading 0.0.*********************************************************/ import java.awt.Color;public class Prob01{//Driver class public static void main(String[]args){ Prob01Runner obj = new Prob01Runner();obj.run(); System.out.println(obj.getMars());System.out.println(obj.getJoe()); System.out.println(obj.getSue());}//end main }//end class Prob01//*******************************************************/ class Prob01Runner{//Instantiate the World and Turtle objects. private World mars = new World(300,274);private Turtle joe = new Turtle(mars); private Turtle sue = new Turtle(mars);public Prob01Runner(){//constructor System.out.println("Dick Baldwin.");}//end constructor //----------------------------------------------------////Accessor methods public Turtle getJoe(){return joe;}public Turtle getSue(){return sue;} public World getMars(){return mars;}//----------------------------------------------------// //This method is where the action is.public void run(){ //Replace the default all-white picture with another// picture. mars.setPicture(new Picture("Prob01.jpg"));mars.getPicture().addMessage( "Dick Baldwin",10,20);//Manipulate the turtle named joe. joe.setName("joe");joe.setBodyColor(Color.RED); joe.setShellColor(Color.BLUE);joe.setPenColor(Color.YELLOW); joe.setPenWidth(3);joe.forward(); joe.turn(-135);joe.setPenColor(Color.BLUE); joe.forward(150);//Manipulate the turtle named sue sue.setName("sue");sue.setPenWidth(2); sue.setPenColor(Color.RED);sue.moveTo(183,170); sue.setPenDown(false);sue.moveTo(216,203); sue.setPenDown(true);sue.moveTo(250,237); }//end run method}//end class Prob01Runner

-end-

Questions & Answers

how to study physic and understand
Ewa Reply
what is conservative force with examples
Moses
what is work
Fredrick Reply
the transfer of energy by a force that causes an object to be displaced; the product of the component of the force in the direction of the displacement and the magnitude of the displacement
AI-Robot
why is it from light to gravity
Esther Reply
difference between model and theory
Esther
Is the ship moving at a constant velocity?
Kamogelo Reply
The full note of modern physics
aluet Reply
introduction to applications of nuclear physics
aluet Reply
the explanation is not in full details
Moses Reply
I need more explanation or all about kinematics
Moses
yes
zephaniah
I need more explanation or all about nuclear physics
aluet
Show that the equal masses particles emarge from collision at right angle by making explicit used of fact that momentum is a vector quantity
Muhammad Reply
yh
Isaac
A wave is described by the function D(x,t)=(1.6cm) sin[(1.2cm^-1(x+6.8cm/st] what are:a.Amplitude b. wavelength c. wave number d. frequency e. period f. velocity of speed.
Majok Reply
what is frontier of physics
Somto Reply
A body is projected upward at an angle 45° 18minutes with the horizontal with an initial speed of 40km per second. In hoe many seconds will the body reach the ground then how far from the point of projection will it strike. At what angle will the horizontal will strike
Gufraan Reply
Suppose hydrogen and oxygen are diffusing through air. A small amount of each is released simultaneously. How much time passes before the hydrogen is 1.00 s ahead of the oxygen? Such differences in arrival times are used as an analytical tool in gas chromatography.
Ezekiel Reply
please explain
Samuel
what's the definition of physics
Mobolaji Reply
what is physics
Nangun Reply
the science concerned with describing the interactions of energy, matter, space, and time; it is especially interested in what fundamental mechanisms underlie every phenomenon
AI-Robot
what is isotopes
Nangun Reply
nuclei having the same Z and different N s
AI-Robot
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Object-oriented programming (oop) with java. OpenStax CNX. Jun 29, 2016 Download for free at https://legacy.cnx.org/content/col11441/1.201
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Object-oriented programming (oop) with java' conversation and receive update notifications?

Ask