<< 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

I'm interested in biological psychology and cognitive psychology
Tanya Reply
what does preconceived mean
sammie Reply
physiological Psychology
Nwosu Reply
How can I develope my cognitive domain
Amanyire Reply
why is communication effective
Dakolo Reply
Communication is effective because it allows individuals to share ideas, thoughts, and information with others.
effective communication can lead to improved outcomes in various settings, including personal relationships, business environments, and educational settings. By communicating effectively, individuals can negotiate effectively, solve problems collaboratively, and work towards common goals.
it starts up serve and return practice/assessments.it helps find voice talking therapy also assessments through relaxed conversation.
miss
Every time someone flushes a toilet in the apartment building, the person begins to jumb back automatically after hearing the flush, before the water temperature changes. Identify the types of learning, if it is classical conditioning identify the NS, UCS, CS and CR. If it is operant conditioning, identify the type of consequence positive reinforcement, negative reinforcement or punishment
Wekolamo Reply
please i need answer
Wekolamo
because it helps many people around the world to understand how to interact with other people and understand them well, for example at work (job).
Manix Reply
Agreed 👍 There are many parts of our brains and behaviors, we really need to get to know. Blessings for everyone and happy Sunday!
ARC
A child is a member of community not society elucidate ?
JESSY Reply
Isn't practices worldwide, be it psychology, be it science. isn't much just a false belief of control over something the mind cannot truly comprehend?
Simon Reply
compare and contrast skinner's perspective on personality development on freud
namakula Reply
Skinner skipped the whole unconscious phenomenon and rather emphasized on classical conditioning
war
explain how nature and nurture affect the development and later the productivity of an individual.
Amesalu Reply
nature is an hereditary factor while nurture is an environmental factor which constitute an individual personality. so if an individual's parent has a deviant behavior and was also brought up in an deviant environment, observation of the behavior and the inborn trait we make the individual deviant.
Samuel
I am taking this course because I am hoping that I could somehow learn more about my chosen field of interest and due to the fact that being a PsyD really ignites my passion as an individual the more I hope to learn about developing and literally explore the complexity of my critical thinking skills
Zyryn Reply
good👍
Jonathan
and having a good philosophy of the world is like a sandwich and a peanut butter 👍
Jonathan
generally amnesi how long yrs memory loss
Kelu Reply
interpersonal relationships
Abdulfatai Reply
What would be the best educational aid(s) for gifted kids/savants?
Heidi Reply
treat them normal, if they want help then give them. that will make everyone happy
Saurabh
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