cs1026_RECAP

cs1026_RECAP - 1 1 Topic X Recap to date Catch me up Notes...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 1 Topic X Recap to date Catch me up Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared by B. Ericson. 2 Recap- Computers run programs- Programs consists of variables and commands (data and instructions)- Variables are Primitive (simple) and Reference (objects)- Commands Types can be: - assignments- comparisons- actions- Objects have Attributes and Methods- Computer Images are made up of pixels arranged in a matrix of rows and columns- Data variables can be linked together as an array of values of the same type (arrays can be one or more dimensions) 2 3 Recap- Computer images can be stored as an array of pixel objects- Arrays of pixels can be either one or two dimensions depending on the task to be fulfilled.- Computer languages have two mechanisms to transverse arrays called loops (for loops and while loops)- Loops can be contained within other loops to create nested loops that will repeat a set of instructions a number of times- One dimensional arrays can be used to change every pixel in an array in the exact same manner.- Two dimensional arrays are used to manipulate individual pixels- Nested loops allow the image to be split vertically or horizontally- While loops are used when conditions consist of more than just counting variables- While loops are used for more complex conditional tests 4 Recap- Logical operators (and, or, exclusive or and not) are used to combine two or more conditions into a single boolean result- User input from a running program can be accomplished using the class of SimpleInput- SimpleInput has three methods:- getNumber- getIntNumber- getString- A picture can be copied from an original existing picture to a new target picture using a nested for loop on an object of Picture- The new picture can be the whole original, a part of the original- The copy process merely reads the color (red, green, blue) values from one picture and copies these numbers to the new picture, pixel by pixel 3 5 Recap (4,0) (3,0) (2,0) (1,0) (0,0) (4,2) (3,2) (2,2) (1,2) (0,2) (4,1) (3,1) (2,1) (1,1) (0,1) (4,0) (180,200,50) (3,0) (180,200,50) (2,0) (180,200,50) (1,0) (170,180,50) (0,0) (180,200,50) (4,2) (180,200,50) (3,2) (180,200,50) (2,2) (180,200,50) (1,2) (180,200,50) (0,2) (180,200,50) (4,1) (180,200,50) (3,1) (180,200,50) (2,1) (180,200,50) (1,1) (180,200,50) (0,1) (180,200,50) SOURCE PICTURE TARGET PICTURE 6 Recap (Copy Picture) (4,0) (3,0) (2,0) (1,0) (0,0) (4,2) (3,2) (2,2) (1,2) (0,2) (4,1) (3,1) (2,1) (1,1) (0,1) (4,0) (180,200,50) (3,0) (180,200,50) (2,0) (180,200,50) (1,0) (170,180,50) (0,0) (180,200,50) (4,2) (180,200,50) (3,2) (180,200,50) (2,2) (180,200,50) (1,2) (180,200,50) (0,2) (180,200,50) (4,1) (180,200,50) (3,1) (180,200,50) (2,1) (180,200,50) (1,1) (180,200,50) (0,1) (180,200,50) SOURCE PICTURE TARGET PICTURE 1.) Start at some pixel of Source Picture i.e. (0,0) 4 7 Recap (Copy Picture) (4,0) (3,0) (2,0) (1,0) (0,0)...
View Full Document

Page1 / 18

cs1026_RECAP - 1 1 Topic X Recap to date Catch me up Notes...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online