WUSTL CSE 131 - sp14_7 (33 pages)

Previewing pages 1, 2, 15, 16, 17, 32, 33 of 33 page document View the full content.
View Full Document

sp14_7



Previewing pages 1, 2, 15, 16, 17, 32, 33 of actual document.

View the full content.
View Full Document
View Full Document

sp14_7

100 views


Pages:
33
School:
Washington University in St. Louis
Course:
Cse 131 - Computer Science I
Computer Science I Documents

Unformatted text preview:

3 1 Using Data Types Introduction to Programming in Java An Interdisciplinary Approach Robert Sedgewick and Kevin Wayne Copyright 2002 2010 1 14 19 03 15 28 PM A Foundation for Programming any program you might want to write objects create your own data types functions and modules graphics sound and image I O arrays conditionals and loops Math primitive data types text I O assignment statements 2 Data Types Data type Set of values and operations on those values Primitive types Values directly map to machine representation ops directly map to machine instructions Data Type boolean Set of Values Operations true false not and or xor int 231 to 231 1 add subtract multiply double any of 264 possible reals add subtract multiply We want to write programs that process other types of data Colors pictures strings input streams Complex numbers vectors matrices polynomials 3 Objects Instance of atype class A class is a set of related Object Holds a data value variable name refers to object behaviors methods Object oriented programming Create your own data types set of values and ops on them Use them in your programs manipulate objects that hold values Data Type Set of Values Operations Color Three ints get red component brighten Picture 2D array of Colors get set color of pixel i j String sequence of chars length substring compare An object a set of data the data a set of methods operating on 4 Constructors and Methods To construct a new object Use keyword new to invoke constructor Use name of data type to specify which type of object To apply an operation Use name of object to specify which object Use the dot operator to invoke method Use the name of the method to specify which operation Java does this automatically when you write s Hello World 5 Image Processing Color Data Type Color A sensation in the eye from electromagnetic radiation Set of values RGB representation 2563 possible values which quantify the amount of red green and blue each on a scale of 0 to 255 R G B 255 0



View Full Document

Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view sp14_7 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view sp14_7 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?