Problem Solving Assignment #5
Turnin for Extra Credit due Sunday, February 10th, 11:59 pm
Turnin due Monday, February 11th, 11:59 pm
Interview due Thursday, February 14th, 11:59 am
Required Reading: Chapter 2, Chapter 3, Chapter 4, Chapter 5, Chapter 6
Please read this whole page and be able to answer the understanding questions before starting on this assignment. Ask a tutor, TA or instructor if you have any questions before you begin.
You will work with a partner on this PSA. Before you begin you MUST have a partner. Please review the guidelines for pair programming. There is an individual interview required for this PSA which is 20% of your PSA grade.
Note: This PSA has a total of 16 points. However, all PSA assignments are weighted equally. The interview is always 20% of the total PSA grade (i.e. if you managed to obtain all 16 points but failed to complete an interview your total PSA grade would be 80%).
Only Picture.java, PSA5.java and the picture files will be collected (pending proper naming). The picture files need to be called pic0.jpg, pic1.jpg, pic2.jpg, etc. All these files need to be inside your PSA5 folder! You may include up to ten pictures named pic0.jpg, pic1.jpg...pic8.jpg, pic9.jpg to use in your collage but also include them in your PSA5 folder. Any other file modified will not be collected and grade will be according to only the files mentioned.
Please read this whole page and be able to answer the understanding questions before starting on this assignment. Ask a tutor, TA or instructor if you have any questions before you begin.
You will work with a partner on this PSA. Before you begin you MUST have a partner. Please review the guidelines for pair programming. There is an individual interview required for this PSA which is 20% of your PSA grade.
Note: This PSA has a total of 16 points. However, all PSA assignments are weighted equally. The interview is always 20% of the total PSA grade (i.e. if you managed to obtain all 16 points but failed to complete an interview your total PSA grade would be 80%).
Only Picture.java, PSA5.java and the picture files will be collected (pending proper naming). The picture files need to be called pic0.jpg, pic1.jpg, pic2.jpg, etc. All these files need to be inside your PSA5 folder! You may include up to ten pictures named pic0.jpg, pic1.jpg...pic8.jpg, pic9.jpg to use in your collage but also include them in your PSA5 folder. Any other file modified will not be collected and grade will be according to only the files mentioned.
Setup
1) Right-click in an open space on the Desktop and select 'Open in Terminal' from the drop down menu.
(it will bring up the following window)
(it will bring up the following window)
2) Highlight the following 10 lines with the mouse, right-click to copy:
cd ../public/PSA5
make directories
make install
cd
cd PSA5
mv PSA5.java.empty PSA5.java
mv Picture.java.empty Picture.java
ls
3) Select the terminal window with the mouse and right-click to paste.
4) Verify that the 'PSA5.java' and the 'Picture.java' files are shown as the result of the last command.
Following these procedures, your files will be named correctly and be located in the correct places. For every assignment you need to follow correct
naming of assignments in the correct locations to get credit for your work.
5) Proceed to start your programming assignment. You must write your code in the files in your PSA5 folder.
cd ../public/PSA5
make directories
make install
cd
cd PSA5
mv PSA5.java.empty PSA5.java
mv Picture.java.empty Picture.java
ls
3) Select the terminal window with the mouse and right-click to paste.
4) Verify that the 'PSA5.java' and the 'Picture.java' files are shown as the result of the last command.
Following these procedures, your files will be named correctly and be located in the correct places. For every assignment you need to follow correct
naming of assignments in the correct locations to get credit for your work.
5) Proceed to start your programming assignment. You must write your code in the files in your PSA5 folder.
Problem
This PSA is a continuation of PSA 4. For this assignment, you will also be making collage. This time you will start with at least 3 different pictures. Each picture will go through at least one filter. You have to write at least one unique filter method (different from any in the original Picture.java, the given examples or in Chapter 5) that does something more than just change the color of the whole picture. Some examples of fun filters are found here. Overall, you should have at least 3 different pictures filtered and collaged on one canvas in an interesting way. There should be NO white space on your canvas at all. (1 pts) You can choose to overlap your pictures if needed to remove whitespace.
Filter methods
Collage method
Main method
collage.show();
Filter methods
- Add at least one new filter method to Picture.java that does not come from the textbook, and use it to filter at least one of the pictures that goes into your collage. Your new method must use an if statement in it. (Think of the cool things you can do with if statements!) (5 pts)
- Use at least 2 other filters(2 pts)
- The methods that you use to filter your pictures can either change the calling object, or (for example in the case of merge and shrink) can make a copy of the calling object, modify it, and return the modified version.
Collage method
- This method should be static and be named collage, and should take in at least three Picture parameters that will be collaged onto the canvas.
- The Pictures passed in to this method should already have had filters applied to them; this method is just for creating the collage.
- This method should return a Picture, which is the final collage (5 pts total)
- The first thing that you should do in this method is create a new picture that will be either 684x504 pixels (landscape) or 504x684 pixels (portrait - the size of 7inx95in.jpg in your media sources folder). If you use personal image files you should resize them (using Picasa, for example) as large images can cause problems with Dr. Java, and with the turnin process.
- You should refer to your previous PSA and the text (page 143-144) for ideas about how to write loops to make the collage.
- NOTE: Unlike your previous PSA, you should not choose pictures of all the same size and put them side by side. You can choose pictures that will make it easy to put them all on one canvas, but make it interesting. There are ways of writing your for loops to design some pretty interesting and good looking pictures. For example, you might write your for loops so that their pictures came out diagonal, upside down, or in interesting positions around the canvas.
- This is your chance to BE CREATIVE. You will not be graded on your creativity, but you should definitely have fun with it, experiment and enjoy this program!
Main method
- In PSA5.java you will choose at least three pictures. So that your collage comes out right, you can hard code the names of the .jpg files of up to 10 pictures as "pic0.jpg", "pic1.jpg", etc. and then include the files with your submission. If you'd like, you can design your program so that it accepts any picture, but this is not necessary, just something that might be fun to experiment with.
- You CAN have the original pictures appear in the collage if you want, but they must also appear again with a filter.
- Call each method you created on the pictures.
- Then call collage the collage method and display the new collage Picture.
collage.show();
- Please see the following image for an example. This is horse.jpg gone through a grayscale, bridge.jpg gone through a negate, those two gone through a blend and barbara.jpg gone through a subtract color then placed in the middle, on top of the blended picture.
How to turnin your homework
1) Open the terminal
2) cd PSA5
3) autograder login -e yourucsdemailhere -p (wait for password prompt)
4) type in your password
5) turnin PSA5
2) cd PSA5
3) autograder login -e yourucsdemailhere -p (wait for password prompt)
4) type in your password
5) turnin PSA5
PSA5 Understanding Quiz
1) Should both partners turn in the assignment?
2) What should the three picture files you turnin be named?
3) Is your collage method static?
4) Suppose you want your collage method to collage 2 pictures on to one canvas. Then you should define the method to take how many parameters?
- Yes
- No
2) What should the three picture files you turnin be named?
- pic0.jpg, pic1.jpg, pic3.jpg
- pic.jpg, pic1,jpg, pic4.jpg
3) Is your collage method static?
- Yes
- No
4) Suppose you want your collage method to collage 2 pictures on to one canvas. Then you should define the method to take how many parameters?
- One
- Zero
- Two
- Three