@@ -0,0 +1,2873 @@
+public class SkyView%0A%7B%0A    /** A rectangular array that holds the data representing a rectangular area of the sky. */%0A    private double%5B%5D%5B%5D view;%0A%0A    /** Constructs a SkyView object from a 1-dimensional array of scan data.%0A     * @param numRows the number of rows represented in the view%0A     * Precondition: numRows %3E 0%0A     * @param numCols the number of columns represented in the view%0A     * Precondition: numCols %3E 0%0A     * @param scanned the scan data received from the telescope, stored in telescope order%0A     * Precondition: scanned.length == numRows * numCols%0A     * Postcondition: view has been created as a rectangular 2-dimensional array%0A     * with numRows rows and numCols columns and the values in%0A     * scanned have been copied to view and are ordered as%0A     * in the original rectangular area of sky.%0A     */%0A    public SkyView(int numRows, int numCols, double%5B%5D scanned)%0A    %7B%0A        view = new double%5BnumRows%5D%5BnumCols%5D;%0A%0A        for (int row=0; row%3CnumRows; row++) %7B%0A            for (int col=0; col%3CnumCols; col++) %7B%0A                if (row %25 2 == 0)%0A                    view%5Brow%5D%5Bcol%5D = scanned%5Brow * (numRows-1) + col%5D;%0A                else%0A                    view%5Brow%5D%5BnumCols - 1 - col%5D = scanned%5Brow * (numRows-1) + col%5D;%0A            %7D%0A        %7D%0A    %7D%0A%0A    /** Returns the average of the values in a rectangular section of view.%0A     * @param startRow the first row index of the section%0A     * @param endRow the last row index of the section%0A     * @param startCol the first column index of the section%0A     * @param endCol the last column index of the section%0A     * Precondition: 0 %3C= startRow %3C= endRow %3C view.length%0A     * Precondition: 0 %3C= startCol %3C= endCol %3C view%5B0%5D.length%0A     * @return the average of the values in the specified section of view%0A     */%0A    public double getAverage(int startRow, int endRow,%0A                             int startCol, int endCol)%0A    %7B%0A        double total=0;%0A        double numValues = 0;%0A        for (int i=startRow; i%3C=endRow; i++) %7B%0A            for (int j=startCol; j%3C=endCol; j++) %7B%0A                total += view%5Bi%5D%5Bj%5D;%0A                numValues++;%0A            %7D%0A        %7D%0A        return total / numValues;%0A    %7D%0A%0A    /*****************************************************/%0A    /***              main method is complete          ***/%0A    /*****************************************************/%0A    public static void main(String%5B%5D args)%0A    %7B%0A        double%5B%5D scanned = %7B0.3, 0.7, 0.8, 0.4, 1.4, 1.1, 0.2, 0.5, 0.1, 1.6, 0.6, 0.9%7D;%0A%0A        SkyView test = new SkyView(4, 3, scanned);%0A%0A        for (int r = 0; r %3C 4; r++)  %7B%0A            for (int c = 0; c %3C 3; c++) %7B%0A                System.out.print(%22 %22 + test.view%5Br%5D%5Bc%5D);%0A            %7D%0A            System.out.println();%0A        %7D%0A%0A        System.out.println();%0A        System.out.println(%22Average = %22 + test.getAverage(1, 2, 0, 1));%0A    %7D%0A%7D%0A%0A

Create Telescope.java