CSE 113 - Spring 2008 - Banner
   CSE 113 - Spring 2008 - Introduction to Computer Programming I
CSE 113 - Spring 2008 - Navigation CSE 113 - Spring 2008 - Assignments: Module 5

Module 5
Last modified: February 24 2008 08:51:40 PM

 

Lab Tasks

You will modify the code you created last time and add additional functionality to your picture. Chapter 4 of the text goes through many of these ideas. Many were also reviewed in class. The code you turn in MUST use the nested loop structure discussed in lecture - NOT the code used to create some of these methods in Chapter 4. Duplicates of the Chapter 4 methods will be given NO CREDIT! Once again, this set of tasks is not necessarily linear. You may have to go back and forth between editing and testing several times before moving on to the next step on the list.

  1. Copy the file you created for Module 4, PictureManipulator.java into your Module 5 directory and rename it to PictureManipulator2.java. This will require changing the name of the class and the constructor.
  2. Leave all of the code you wrote for Module 4 inside the class, except comment-out the code inside the constructor so it does not run every time you are testing. You will simply be adding to the code for Module 5.
  3. All of your methods will follow this basic template:
  4. 	       public void methodName(Picture picture) {
                    //body of method - work that needs to be done to picture
                    picture.explore();
               }
    	  

  5. To test out your methods, you need to create an instance of a PictureManipulator2 in the Interactions pane and then create an instance of a Picture. Call the appropriate method on the PictureManipulator2 and pass in the Picture object.
  6. Create a method named decreaseGreen45, which decreases the amount of green in the picture passed in as a parameter by 45%.
  7. Create a method named increaseBlue60, which increases the amount of blue in the picture passed in as a parameter by 60%.
  8. Create a method named modifyRed. This method takes in two parameters, the Picture as stated above and a double percent. This method changes the red component of all the pixels in a picture by the specified amount.
  9. Create a method named darkenPicture, which uses the darken method of Color to darken the picture. Recall that we did lighten in lecture.
  10. Create a method named greenOnly, which completely removes the red and blue component of each pixel, leaving only the green component.


Save Your File

You should save the file you created, named PictureManipulator2.java into your own module5 directory.


Submission

You should make sure to name your class and save your file with the name PictureManipulator2.java. Submit this file by going back out to the Unix prompt and typing:

submit_cse113 PictureManipulator2.java


Due date

Your lab submission is due no later than 11:59:59 pm on March 7th. Remember, no late labs will be accepted.


Lab authored by Adrienne Decker

CSE 113 - Spring 2008 - Footer

 

 
Page Maintained by: Adrienne Decker