Module 8
Last modified: March 31 2008 05:34:33 PM
Lab Tasks
In this lab, you will combine all of the methods you wrote previously into one class that is actually its own stand alone program.
If you were not able to implement all of the methods from the previous modules, don't worry, you'll see how to handle that in the description below.
You will need to refer to the information in Chapter 11 while completing this lab.
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.
- Create a file that contains a class named
PictureProgram
(the file needs to be called PictureProgram.java
)
- Create a constructor for this class that takes no parameters and has an empty method body.
- Create a
main
method for this class (see 11.6 for syntax).
- This
main
method should first create a variable whose type is PictureProgram
and is assigned the value of creating a new PictureProgram
. You will need this object to call your methods on.
- This
main
method should create a variable whose type is Picture
and whose value is assigned by creating a FileChooser
and having the user select a file.
- Then create a variable named
pictureResult
whose type is Picture
. You will assign the result of calling the decreaseGreen45
method to this variable.
- Call
pictureResult.show()
- At this point, the program will probably not compile. You need to copy the
decreaseGreen45
method from your Module 5 file into this file.
- For every method you copy from another module, you may need to change the code to ensure the following:
- The method takes a parameter of type
Picture
- The method has a return type of
Picture
and returns the modified picture
- The method does not call
show
or explore
inside its method body
- If you were unable to correctly complete the method from a particular module, you should comment-out the code you wrote for the method (DO NOT DELETE IT) and then place a statement that will print to the console "Was not able to implement the method XXXX" where you replace XXXX with the method that was unimplemented. After the print statement, you should put the statement
return null;
in the code for the method. You should not call show()
after calling a method that you were unable to implement.
- After you get the code to compile, you should run it and see the results of the method.
- Continue on with this process for
increaseBlue60
.
- After copying this method - YOU NEED TO STOP AND RUN YOUR PROGRAM to ensure it works.
- Continue this process for the remainder of the methods in modules 5, 6, and 7. After putting each method in the file, you should ensure that the program still runs.
Save Your File
You should save the file you created, named PictureProgram.java
into your own module8
directory.
Submission
You should make sure to name your class and save your file with the name PictureManipulator4.java
. Submit this file by going back out to the Unix prompt and typing:
submit_cse113 PictureProgram.java
Due date
Your lab submission is due no later than 11:59:59 pm on April 11th. Remember, no late labs will be accepted.
Lab authored by Adrienne Decker