Presentation is loading. Please wait.

Presentation is loading. Please wait.

Barnes Art Museum, Philadelphia

Similar presentations


Presentation on theme: "Barnes Art Museum, Philadelphia"— Presentation transcript:

1 Barnes Art Museum, Philadelphia
Dr. Albert C. Barnes built an art gallery in his house. A museum guard there actually said it was his Bat Cave, and he would go there at night and rearrange the pictures. (Interesting African-American social history story; The Art of the Steal 2009 movie about the continuing controversy) Unusual: Each wall had many paintings, closer together than in typical museums. (based on Barnes' principles of art history education.)

2

3

4 What Proj 06 involves Moving values around within a 3 element array, without losing any. Swapping 2 values between a given array element (given how?) WITH a simple variable. (don't lose either value) Layout problem solving: Where to copy the pictures so you can see them (easy) Where to copy the pictures so they are centered. Making it a 1-week project: limit to 4 pictures, with known maximum sizes. READ THE ASSIGNMENT!

5

6 iClicker: Each array element is a variable
iClicker: Each array element is a variable. How is any one array element given—in Java? By the array name only. By a memory address. By the array reference AND and an int index value for the subscript. By an int index value only: The array reference in NOT NEEDED. By the array reference OR the index: You can choose which one to use, but only one is needed.

7 Project 6 data structure diagram
favorite arrayPicts s are Java references, locations, (Java) “addresses” of 5 objects 3 length

8 3 s are Java references, locations, (Java) “addresses” of 5 objects
favorite arrayPicts s are Java references, locations, (Java) “addresses” of 5 objects 3 length Java hides internal data for addressing the array in memory. You can read, not change the length field.

9 3 swap the ref. values: Now picture 3 is first, 2 middle! favorite
arrayPicts swap the ref. values: Now picture 3 is first, 2 middle! s are Java references, locations, (Java) “addresses” of 5 objects 3 length

10 1492 1492 1984 1984 2001 2001 arrayNum Try to program swapping arrayNum[0] with arrayNum[1] First try: arrayNum[0] = arrayNum[1]; BAD!!! it loses data 1492 3 1984 1984 2001 length

11 THE CLUE:FIGURE YOURSELF HOW TO USE THIS CLUE!
1492 1984 1984 2001 2001 arrayNum Try to program swapping arrayNum[0] with arrayNum[1] int tempSaver;//use a temp! tempSaver = arrayNum[0]; tempSaver 1492 3 YOU: Figure out the 2 lines of code to achieve the goal below. length 1984 1492 2001

12 Problem: Make the computer calculate where to copy the pictures
so the spacings are equal.

13

14 When somebody calls myHouseRef.showArtCollection( )
Each time the pictures are rearranged, the distances needed to keep them centered must be recomputed. When? When somebody calls myHouseRef.showArtCollection( ) You will write code to copy 4 Pictures into the ArtWall. Put that code in (the body of) the showArtCollection( ) House method)

15 Getting Started with Project 6: DON'T TRY FOR equal spacing at first!
You'll get 90% if you just help Dr. Barnes re-arrange his favorite and 3 others with swaps and rotates, and see them; even if they are not centered.

16 Pre-calculate these distances: so any of the 4 test pictures can fit in any of the sub-rectangles.
corner coordinates too.

17 PUT AWAY THAT COMPUTER! WRITE NO CODE!
HOW TO Be Smart: PUT AWAY THAT COMPUTER! WRITE NO CODE! Figure out what needs figuring ON PAPER, so you understand EXACTLY what you are figuring. But first, get the facts. For our Proj06, read and make notes of the facts from the project assignment (on the computer). Ask Prof. for a free paper copy if that's your style.

18 Facts needed: How many pictures, where? Max height of one picture. Max width of one picture. (We show how to use these facts to solve the 90% problem on paper, and will scan it.)

19 Solve the centering problem
(writing will be scanned and posted after the lecture)

20

21 Equal Equal Equal Equal

22

23

24


Download ppt "Barnes Art Museum, Philadelphia"

Similar presentations


Ads by Google