CS 2500: Project 1 -- Find Stars

Due Monday, Sept. 19, 5:00 pm

 

For this project, you will develop a Java program that will read a data set containing illumination levels for a section of the sky. Your program will analyse the data set, and identify the locations of stars within the image.

Submission: We will be using the CS Homework Submission system ( https://hopper.csustan.edu/cshomework/ ). We'll talk in more detail about this in class.

Input data: There are two options for input -- either the input to the program will come from the console, or you can implement a "file picker" (we'll discuss this more in class).

The data set will consist of r+1 lines of numbers.

The first line will consist of two integers in the range
2 < r, c < 30, separated by at least one space.

The next r lines will each consist of c integers in the range
0 < j < 10.

The first two numbers tell the number of rows and columns in the illumination data set. The rest of the numbers are an array of relative brightnesses.

Analysis: For the purposes of this project, a "star" is a cell in the array whose brightness is at least 4 greater than each of the adjacent cells. A cell in general position has 8 adjacent cells. An edge cell has 5 adjacent, and a corner cell has 3 adjacent.

Output: Your program will echo the input data, then show an array with asterisks "*" where there are stars, and spaces where there are not stars, then a list of coordinates where there are stars.

Scoring: The maximum possible score for the project will be 80 points. There will be up to 40 points for correct operation of your program, and up to 40 points for style, comments, etc.

Late programs will have their maximum possible score reduced to 0.9 times previous for each calendar day late (i.e., maximum possible score = 80 * (0.9^n) for n days late . . .).


Example:

Input data:

10 10
1 1 2 1 3 2 7 2 1 6
2 1 6 2 6 2 1 2 1 1
1 2 1 2 1 2 1 2 1 2
7 1 2 4 1 2 1 7 1 1
2 1 2 7 1 2 1 1 2 1
1 2 1 2 1 5 1 2 7 1
1 2 1 2 1 1 7 1 1 2
2 1 1 2 1 1 1 1 2 1
1 1 9 5 1 1 2 1 1 1
1 1 2 1 2 1 2 1 2 1

Output:

Here are the data:

     1  2  3  4  5  6  7  8  9 10
  1  1  1  2  1  3  2  7  2  1  6
  2  2  1  6  2  6  2  1  2  1  1
  3  1  2  1  2  1  2  1  2  1  2
  4  7  1  2  4  1  2  1  7  1  1
  5  2  1  2  7  1  2  1  1  2  1
  6  1  2  1  2  1  5  1  2  7  1
  7  1  2  1  2  1  1  7  1  1  2
  8  2  1  1  2  1  1  1  1  2  1
  9  1  1  9  5  1  1  2  1  1  1
 10  1  1  2  1  2  1  2  1  2  1

Here are the stars:

     1  2  3  4  5  6  7  8  9 10
  1                    *        *
  2        *
  3
  4  *                    *
  5
  6                          *
  7
  8
  9        *
 10

The stars are located at:

  1  ( 1, 7)  ( 1,10)
  2  ( 2, 3)
  3
  4  ( 4, 1)  ( 4, 8)
  5
  6  ( 6, 9)
  7
  8
  9  ( 9, 3)
 10