CSCI 201 Spring 2003

Programming Project 1

Work problem 2.7 on page 123 of your text. In this program, you will work with integer numbers. You should use the Keyboard class (provided by the authors' of your text) to make the job of reading integers from the keyboard easy. To use this class, follow these brief instructions:

  1. Create a jGRASP project for this program keeping all the files for this project in a separate folder (i.e., create a directory that will contain only the files used in this project). Create both the project and the project folder as described in lab 2. You may choose any names you like for the project folder and the project file.
  2. Download the java source code for the Keyboard class using this link, and store it in the project folder created in step 1.
  3. In jGRASP, open the project, and select Add Files To Project... from the Project menu option on the jGRASP tool bar. In the pop-up window that appears, select or type the File Name Keyboard.java and then select Add. The Keyboard class is now included in your project.
  4. Now create a new java file to contain the source code for your program. Saved this file in the project folder giving it the name Time.java; the file must be named Time.java in order to receive full credit for this assignment. Now add Time.java to your project as described in the step above, replacing Keyboard.java with Time.java.
  5. To use the Keyboard class in your program (i.e., Time.java) you simply need to include the following line of code at the start of your program:
      import cs1.Keyboard;
    
    Remember that capitalization is important. There are simple examples of programs that use the Keyboard class in chapter 2 of your text.

Programming Style

Note that 10% of your program grade is based on the readability of your program. This includes things like proper indentation, comments, and the naming of variables and methods. To receive full credit for your program, make sure that you use proper indentation as demonstrated in your text and in class room examples. Also include a comment at the top of each program stating your name, the course, and the purpose of the program:

// Name: your name here // // Course: CSCI 201 // // Purpose: purpose of program here //

Submitting Your Program

The program written for this assignment must be turned in by transferring the java source code file to your ftp directory for this class. Only the source code file (i.e., Time.java) should be turned in and the file must have exactly that name. You were shown how to transfer files to your class ftp directory in lab 1