<< Chapter < Page Chapter >> Page >
Learn how to create and manipulate Turtle objects and Picture objects in a World object using the Guzdial-Ericson multimedia library.

Revised: Sat Apr 02 13:20:42 CDT 2016

This page is included in the following Books:

Table of contents

Preface

This module is one of a series of modules designed to teach you about Object-Oriented Programming (OOP) using Java.

Before embarking on the material in this module, you should have studied and should understand all of the material in the modules identified as Java1600 through Java1630 in the section of this book titled Essence of OOP and you should have studied and should understand allof the material in the following books:

The program described in this module requires the use of the Guzdial-Ericson multimedia class library. You will find download, installation, and usageinstructions for the library at Java OOP: The Guzdial-Ericson Multimedia Class Library .

Viewing tip

I recommend that you open another copy of this document in a separate browser window and use the following links to easily find and view the Figures and Listings while you are reading about them.

Figures

  • Figure 1 . Graphic screen output.
  • Figure 2 . Command-line output.
  • Figure 3 . Commands to compile and execute the application.
  • Figure 4 . Constructors for the World class.
  • Figure 5 . Constructors for the Turtle class.
  • Figure 6 . Constructors for the Picture class.

Listings

Preview

In this module, I will explain a program that uses Java and Ericson's media library to (see Figure 1 ) :

  • Add a picture and two turtles to a world.
  • Manipulate the turtles, their colors, and their pens.

Stated in more detail, the program will:

  • Create a Picture object from an image file and replace the default white Picture in a World object with the new Picture object.
  • Place two Turtle objects in a World object.
  • Apply a series of operations to manipulate the two turtle objects so as to produce a specific graphic output.
  • Provide accessor methods to get references to two Turtle objects and the World object.
  • Use the references to get information from the World and Turtle objects and display that information on the command-line screen.
  • Display text on a Picture in a World object.

Program output

Figure 1 shows the graphic screen output produced by this program.

Figure 1 - Graphic screen output.

Image of two turtles maneuvering in front of a background image.

Figure 2 shows the text output produced by the program on the command line screen.

Figure 2 . Command-line output.
javac 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.

Questions & Answers

What is deflation
Aluko Reply
Enumerate emotional intelligence to a manager
Chinonso Reply
What about Sydney Alexander's Absorption approach in international trade?
Vibhas Reply
I need help in inflation graphs
Brandon Reply
Select inflation type, Demand pull, cost pull or anticipation 1- Select the set of data you intend on graphing i.e inflation rate of 2017, location (particular country) 2 - Select the type of measurement tool that best allows you to input the inflation data, Consumer price index is the most accurate
Jama
this is to make sure you have all the correct information, Also use should know 1- Cost pull is Aggregate Demand and Aggregate Supply AD - AS graphed 2- Demans pull is Aggregate Supply and Aggregate Demand AS - AD graphed
Jama
what is production
Imoro Reply
what is a monopolistic competition?
moniman Reply
Enumerate emotional intelligence to a manager
Chinonso
Enumerate emotional intelligence to a manager
Chinonso
who is barter
Tening Reply
exchange goods each other
Seven
what is economic
Bah
is the use of scares resources to satisfy our unlimited needs and wants
Desiderius
how many kinds of utility functions?
Sadaf
What is partnership?
Jackson
the legal association of two or more people as co-owners of a business for profit.
harmony
Would you expect the kinked demand curve to be more extreme (like a right angle) or less extreme (like a normal demand curve) if each firm in the cartel produces a near-identical product like OPEC and petroleum? What if each firm produces a somewhat different product?
James Reply
no
Sadaf
what is supply
Mizta Reply
what is opportunity cost
Mizta
The opportunity gained interms of opportunity lost is known as opportunity cost Or The second best alternative use of resources
Mir
forgone alternative: like forgoing Something our of two to buy one
Tam-Waribo
what is macro economic s
Addo Reply
macroeconomics is the study of economic as a whole level.
Gafar
meaning of positive science
Sumit Reply
positive science it is focused on facts and cause and effect and behavioural relationship and include developmental testing in economic theoreis.
Gafar
what is inflation
Sama Reply
inflation is the general price increase of goods and services in an economy.
tesfie
Inflation is the persistent rise in the general price level
T-Max
inflation is characterized by increase in the general price of goods and services. when there is too much money in circulation. increase in demand of goods pursuing fewer goods. when purchasing power of money decreases .
Ejikeme
inflation is the persistent rise general price level
Habeeb
inflation is the persistent increase in price
Machall
hi
Rafiu
yes
boston
hi
Ayaan
how are you
Ayaan
increase in the general level of price...
sade
what is deflation
Sele
is the gradual decrease of currency exchange in a country.
Gafar
why ecnomics important ? give answer plz
Saifullah
Because is a field of science study that reflects on our day to day activities with human behavior.
ANSU
why economic is a science
Imoro
Economics is referred to as a social science not a pure science. It's regarded as a social science because it makes use of the scientific method to solve problems. The scientific method refers to observation, asking questions, forming hypothesis, experimentation etc
Nkechi
Economics is a social science because it study human behavior how he relates with his daily activities with the available limited resources to satisfy his wants.
Ojo
what are the factors affecting the demand
Mohammed
yeah it uses the scientific method to study human behaviour.
Nkechi
inflation referes to the persistant increase in the general price of goods and services over a given period of time say a year.
Abdul
factors affacting Demand of good and services are 1.price of a commodity in question 2.price of related commodity 3.Income of a consumer 4.Population 5.tast and prefereance 6.Season or weather condition
Abdul
what is difference between perfect and non perfect market.
Saheed
what the difference between Trade off and Opportunity Cost?
Elzevery
answer
Golda
In trade off, you increase the amount of something by decreasing the amount of something else. For example, you use 2 hours to study and 2 hours for leisure. if you increase study hour by 1 more hour, i.e 3 hours, leisure time will decrease by 1 hour, i.e 1 hour.
harmony
In all, you would have traded off 1 hour of leisure time for 3 hours of study time. But in opportunity cost, you let something go in order to obtain something else entirely.
harmony
thanks for your idea
Elzevery
please i want help on thid question given P=$10 And TC=120+4Q2 1.find the profit maximizing level of price and quantity. 2.what will be the total profit?
Shemels
please how is substitutional effect affecting demand
Acha
if a price of a particular commodity is high people demand less ,they rather go for less one
FIDELIS
what is account
Wasif
account is an arrangement between a customer and a bank that allows the customer to play in and take out money (bank account)
Johnny
pay, not play sorry
Johnny
four effects of inflation in an economy
Acha
oil
TsendeTheRipper
decreases living standards .. decreases purchasing power.. Decreases internation competition . increases the cost of borrowing
MansoorAfghan
Inflation refers to persistent increase in the general prices of commodities.
Aluko
he asked for effects
MansoorAfghan
Low standard of living, prices of commodities will be high, devaluation of currency in the economy
Aluko
Debtors gain while creditors loses
Ojo
Hi every one
Ani
Hello
Ansah
hi
kelvin
hi
Seven
Hii
raushan
how are you all
Seven
Fin and you
raushan
me also
Seven
Whare do you live
raushan
general tendency of rising price and continuous... .
Auqib
any one among you is going to aaper in net exam day after tomorrow
Auqib
reply?
Auqib
pakistan
Seven
Oo Pakistan I am India
raushan
really from Pakistan
Auqib
ok
Seven
You noo hindi
raushan
no
Seven
hi
ken
what is deference between the producer and firm?
ISMAILI
A producer, going by its name, only makes tangible goods and services from the use of raw materials or from the ground up. Meanwhile, a firm can be a wholesale corporation can depends directly on the finished goods and services of the producer in order to resell to the market.
harmony
Okay! I got a point.. so can you give an examples Harmony?
ISMAILI
An example for the producer would be Microsoft Corporation that makes Windows Operating System for computer-making firms like Acer, Dell, Hp, etc.
harmony
Calculate the elasticity coefficient when price decrease from 60 to 50 and 40 to 30 interpret the result
Acha
Thanks for your ideas bro..
ISMAILI
My pleasure, Shabani.
harmony
hi
Habib
hello rum I can see some great economists here
olasupo
And how does this thing even work
MansoorAfghan
does everyone on the app get the questioms
MansoorAfghan
ns
MansoorAfghan
mec
Abdul
different between demand and quantity demand
Farhan Reply
No difference
MansoorAfghan
demand is the overall demand for it
MansoorAfghan
actually theres no difference
MansoorAfghan
quantity demanded is used in Equilibrium of d and s
MansoorAfghan
for evrything else u use deman
MansoorAfghan
the difference of it is that when demand simply denotes the willingness and a person's ability to purchase. And as against quantity demand represent the amount of an economic good or services desire by a consumer at a fixed price .☺
Gafar
how to calculate inflation
Richard Reply
Explain the factors that have led to high quantity demanded
Ogwang Reply
price of the product increase of price substitute product as people shift to cheap one
Black
Give examples of non-banking institution.
Aluko
microfinance bank is one good example of non-banking institution
Odeniyi
While the American heart association suggests that meditation might be used in conjunction with more traditional treatments as a way to manage hypertension
Beverly Reply
in a comparison of the stages of meiosis to the stage of mitosis, which stages are unique to meiosis and which stages have the same event in botg meiosis and mitosis
Leah Reply
Got questions? Join the online conversation and get instant answers!
QuizOver.com Reply

Get the best Algebra and trigonometry course in your pocket!





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