CS 140 - Homework 1 - Due Jan 23
Name:___________________________________
Answer the following questions:
-
Consider the representation for pictures described in
Section 1.3 where each pixel in the picture is represented by three
bytes (one for each color: red, blue, and green).
-
How many bytes does it take to represent a 640x480
pictures (a common picture size)?
-
How many bytes does it take to represent a 1280x1024
picture (a common desktop size)?
-
Knowing this, what do you suppose is meant when a digital
camera has a "5 megapixel" rating?
-
Calculate, (or try in DrJava) the following Java calls:
-
Declare variables with reasonable types and assign them the appropriate
values for the following purposes:
- Example, The price of my lunch
double lunchPrice = 5.25;
- The number of people in your family.
- Your name.
- The temperature in the room.
- Your telephone number
- Answer to, "Are you lefthanded?"
- What does it mean to compile a program?
- What is a classpath?
- Identify which of the following are class methods and which are object methods:
- Math.abs(-3);
- soundObj.play();
- FileChooser.pickAFile();
- pictureObj.show();
- ColorChooser.pickAColor();
- turtle1.turnLeft();
-
Relating to the previous question, how can you tell the difference
between object and class methods?
© Rich Sharp (modified by Ed Harcourt)