0. Executive Summary [ADVANCED LAB]

This is the first graded lab for CS2102. You will be graded by your ability to make progress on the primary task. Note that this is the advanced lab.

1. Stated Aims

  1. Develop experience using the java.util.Scanner class
  2. Learn how to apply loops.
  3. Understand how to read from the keyboard information that has structure
  4. Understand the nature of nested loops.

2. Background knowledge

  1. Understand arrays
  2. Understand Java for loop
  3. Understand how to read input from the command line
  4. Understand how to output to the screen using System.out.println

3. Setup

If you are in the Lab, perform the routine KH 202 setup or AK 120D setup; for now, ignore the "advanced setup" options. If you would like to set up  Eclipse on your personal computer, then (a) install Java JDK 1.5 if you need to as described in tools section (here); and (b) install Eclipse as described in tools section (here).

4. Primary Task

Design a program where the user enters a set of integers and you output a permutation of these numbers such that all the negative elements (if any exist) precede all the positive elements (if any exist). Note that a negative integer is an int ≤ -1 while a positive integer is an int ≥ 1.

4.1. Design Recipe

Review the design recipe we have been following. Design questions to be answered:

Note: do not go out of your way to describe every possible form of input. If you only considered one form, then state that. Don't invent spurious alternatives that were never really taken seriously.

5. Primary Task

Create a class AdvancedLab1 in the package defined by your CCC unix name.

6. Hint

Given a scanner constructed from System.in, you can read the next integer simply by invoking the nextInt() method call. Refer to the class examples, and the book (Section 2.2, pp. 78)

7. Turnin

Your goal is to turnin the assignment file (AdvancedLab1.java) by November 1st  at 11:59 PM.  The name of the assignment you should use is "lab1".

Change History

Date Reason/Change
10/16/06 Initial Page