CS 100 - Computer Literacy, Fall 2004

Lab 10

This lab assignment will have you write a jython program that will use some built-in JES functions to retrieve some basic information about an image.

Reminder

The program Jython Environment for Students (or JES) is the development environment that we will use for this lab.

In the ACCC Labs, JES can be found by:

  1. Click on Start
  2. Then click on All Programs
  3. Then click on Class Applications
  4. Then click on Engineering
  5. Finally click on Jython Environment for Students

Comments in JES

Programs are designed to be read by a computer. Thus they are not always that easy to read by a person. To help a person read a program, comments should be added to help describe what is going on.

Of course, these comments may help a person understand what is going on, but they normally confuse a computer reading the program. Thus we need to use a special symbol to inform the computer where the comments are so the computer can ignore them.

In JES, the # character is used to indicate a comment to the computer. The # character is often called the "pound" character, the "sharp" character or the "number" character. Prof. Troy refers to it as the "pound" character; however, many people use the term "sharp" after the music notation. Also Microsoft's programming language C# is called "C sharp".

In JES, anything typed on a line after the # character will be considered a comment and ignored. JES displays comments in green text and the # character is also part of the comment.

At the beginning of every program, you will now be required to have a comment (or multiple comments) that contains your name, your NET-ID, the class name, assignment name and a short description of the program. Thus each program should begin with something similar to the following:


# Pat Troy
# troy@uic.edu
# CS 100 - Lab 10
# 
# A short program to display the color intensity of
# the last pixel in an image.

Pixels in an Image

Every image is made up of a grid of picture elements called pixels. Each pixel can be identified by the column and row where its resides in the grid. The primary information contained by each pixel is its color. These colors are identified by the amount of red, green and blue sub-colors contained in the color. Each of the three sub-colors has value from 0 to 255 that specifies the intensity of the color. An intensity of 0 indicates that none of that color is present. An intensity of 255 indicates that as much as possible of that color is present.

You should check out the JES command of pickAColor() to play with the various colors. You can just type in pickAColor() in the command window to see how it works.

New JES Commands

Lab Assignment 10

Due: Friday 11/5/2004 by 8:00 am

Create a file using JES that will

  1. Contain a comment indicating your Name, Net-ID, Course Name, Assignment Name and a short description of the assignment (see the example above)
  2. Contain a JES function that will allow the user to pick and display an image (see Lab 9 regarding this).
  3. The function must also print out

The "last" pixel in the image is the pixel in the very last column and very last row of the image. Remember the width of an image gives the number of columns and the height of an image gives the number of rows.

On the ACCC lab computers, the H: drive is a permanent storage area for you. Saving files to this drive on one computer can be accessed from another computer (even another computer in a different lab). It is suggested that you save your python programs to the H: drive.

Use the UNIX turnin command to electronically hand-in your python file using the project name of lab10. Note: you will need to transfer your python file to your icarus account before you can use turnin. You can do this by using the file transfer function of SSH or by emailing your python file to your incarus account. To submit the file in <filename>.py for lab10, the turnin command is entered as:

     turnin -c troy -p lab10 <filename>.py