<< Chapter < Page Chapter >> Page >
Listing 1 - Write the Java application described below.

/*File Prob01 Copyright 2012 R.G.Baldwin

Write a program named Prob01 that uses the class definition shown below and Ericson's media libraryalong with the image file named Prob01.jpg to produce the graphic output image shown in Figure 1 below.

Click Prob01.java to download a Java source file containing the solutionto this program.

In addition to the output image, your program must display your name and the otherthree lines of text shown below on the command-line screen:

Display your name here. A 300 by 274 world with 2 turtles in it.joe turtle at 256, 131 heading 45.0. sue turtle at 50, 37 heading 0.0.*********************************************************/ public class Prob01{//DO NOT MODIFY THE CODE IN THIS CLASS DEFINITION. 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 Prob01nd program specifications.

Figure 1 - Required output image for Prob01.

Missing image

Program 2

Discussion

The following is a non-exhaustive list of concepts that you need to understand along with knowledge and skills that youneed to possess in order to successfully write this program and/or understand the given solution in Prob02.java . Some of these items are general in nature and some are specific to the use of Ericson's multimedialibrary. I won't repeat the items listed under Program 1 above. Instead, I will concentrate on new concepts, knowledge, and skills not included in the above list.

  • How to design and implement an algorithm that will transform Prob02.jpg into the image shown in Figure 2 .
  • How to declare and initialize instance variables in a single statement.
  • How to instantiate a new object of Ericson's Picture class encapsulating the contents of a local image file.
  • How to call methods on the new Picture object for a variety of purposes.
  • How to declare a reference variable capable of storing a reference to a one-dimensional array object.
  • How to populate a one-dimensional array object of type Pixel[] with references to all of the Pixel objects encapsulated in a Picture object.
  • How to use a l oop structure to individually access the reference to each Pixel object in the array object.
  • How to use a reference to a Pixel object to modify the red, green, and blue color values belonging to the pixel that is represented by the Pixel object.
  • How use a pair of PictureExplorer objects to design and implement an algorithm that will transform the original image into the required output image shown in Figure 2 .
  • How to display your modified Picture object in an object of Ericson's PictureExplorer class.
  • How to confirm the validity of your algorithm by numerically comparing the color values in your output with the color values produced by compiling and running the program solution given below.
Listing 2 - Write the Java application described below.

/*File Prob02 Copyright 2012 R.G.Baldwin

Write a program named Prob02 that uses the class definition shown below and Ericson's media libraryalong with the image file named Prob02.jpg to produce the graphic output image shown in Figure 2 below.

Click Prob02.java to download a Java source file containing the solution to this program.

In addition to the output image, your program must display your name and the other text shownbelow on the command-line screen:

Display your name here. Picture, filename Prob02.jpg height 274 width 365*********************************************************/ public class Prob02{//DO NOT MODIFY THE CODE IN THIS CLASS DEFINITION. public static void main(String[]args){ Prob02Runner obj = new Prob02Runner();obj.run(); System.out.println(obj.getPicture());}//end main }//end class Prob02//End program specifications.

Questions & Answers

what is biology
Hajah Reply
the study of living organisms and their interactions with one another and their environments
AI-Robot
what is biology
Victoria Reply
HOW CAN MAN ORGAN FUNCTION
Alfred Reply
the diagram of the digestive system
Assiatu Reply
allimentary cannel
Ogenrwot
How does twins formed
William Reply
They formed in two ways first when one sperm and one egg are splited by mitosis or two sperm and two eggs join together
Oluwatobi
what is genetics
Josephine Reply
Genetics is the study of heredity
Misack
how does twins formed?
Misack
What is manual
Hassan Reply
discuss biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles
Joseph Reply
what is biology
Yousuf Reply
the study of living organisms and their interactions with one another and their environment.
Wine
discuss the biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles in an essay form
Joseph Reply
what is the blood cells
Shaker Reply
list any five characteristics of the blood cells
Shaker
lack electricity and its more savely than electronic microscope because its naturally by using of light
Abdullahi Reply
advantage of electronic microscope is easily and clearly while disadvantage is dangerous because its electronic. advantage of light microscope is savely and naturally by sun while disadvantage is not easily,means its not sharp and not clear
Abdullahi
cell theory state that every organisms composed of one or more cell,cell is the basic unit of life
Abdullahi
is like gone fail us
DENG
cells is the basic structure and functions of all living things
Ramadan
What is classification
ISCONT Reply
is organisms that are similar into groups called tara
Yamosa
in what situation (s) would be the use of a scanning electron microscope be ideal and why?
Kenna Reply
A scanning electron microscope (SEM) is ideal for situations requiring high-resolution imaging of surfaces. It is commonly used in materials science, biology, and geology to examine the topography and composition of samples at a nanoscale level. SEM is particularly useful for studying fine details,
Hilary
cell is the building block of life.
Condoleezza Reply
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