Computer Science 252
Problem Solving with Java

Fall 2013, The College of Saint Rose

Lecture 2: Objectdraw Basics
Date: Thursday, September 12, 2013


Lecture 2 Assignment

Due at the start of class, Tuesday, September 17.

Please submit answers to these questions in Submission Box under "LA2" by the start of our next class. We will discuss these questions at the start of class, so no late submissions are accepted.

A little review from your previous Java experience here...

  1. Each of the following describes a piece of data that you might use in a Java program. Give a valid and stylistically appropropriate declaration (a type and a name) for a variable that would contain that data. (1 point each)

    a. The red component for a Color to be constructed.

    b. A student's GPA.

    c. The home team's current score in a baseball game.

    d. The outline of a rectangle that represents the trunk of a tree.

    e. A piece of text displayed on the canvas that contains instructions for how to play a game.

  2. Evaluate each of the expressions below given the following variable declarations. Some may evalulate to a boolean (true or false), others to a number of type int or double. (1 point each):
    int x = 7;
    int y = -3;
    int z = 1;
    double a = 7.5;

    x - z > y

    x/2 + y

    x/2.0 + y

    a/2 + z

    a + x * y + z

    !(x > z) && (a + x + y + 12 < 32) && (a * a * a / 4 == 12)

    true || (x * y * z / a < 11)