Sie sind auf Seite 1von 3

CSE 17 Programming Assignment 1 Due: 5/28/13 at 11:00 PM Project Name: Prog1 Point Value: 20 This homework is an exercise in:

1. Using the NetBeans environment 2. Basic Java programming 3. Submitting a homework assignment. For some of you it will be quite easy; for others it will involve some frustration in getting used to the NetBeans environment and the act of ftp-ing. As with all the assignments in CSE 17, it is unwise to wait until the last minute (or hour or day) to do this assignment. Your grade on this assignment depends mostly on your promptness and your ability to follow the instructions below. In NetBeans create a new Java project called Prog1 by using the following sequence of actions: File | New Project | Category: Java | Projects: Java Application| Next button | Project Name: Prog1| (take note of the Project Location and change if you wish) | Finish button Btw, case counts! The project name is Prog1, not prog1. At this point you should have a file in the editor window that looks similar to this:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package prog1; /** * * @author jfemister */ public class Prog1 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here } } Clean up the comments inserted by NetBeans.

Then, edit this empty program into a program that does the following: 1. The main method in your program reads in a series of integers from the console, 5 lines, 5 integers per line. The integers on a line are separated by blanks. The integers are stored in a 5 x 5 array of ints. 2. Pass this 2 dimensional array of ints to a method: private static void sumrowsandcols(int[][] a) which will calculate the sum of each row and write the list of sums out to the console in a single row and then do the same thing with the columns. If the input integers looked like this: 11111 22222 12345 44444 66666 then the output would be: 5 10 15 20 30 14 15 16 17 18 When the class is run (either select Run | Run Main Project or hit F6 or click the button with the green triangle pointing to the right on the toolbar) NetBeans should open up the Output window and wait for the input numbers to be entered. When the 5th row has been entered, NetBeans should display the results in the output window. Test the program on the array of numbers shown above and then test it on the following arrray: 17 24 23 5 4 6 10 12 11 18 1 7 13 19 25 8 15 14 16 20 22 21 3 2 9

Your program must run correctly regardless of the number of spaces between numbers! Once the class functions properly, ftp the entire project directory to the subdirectory cse017.xxx (the xxx will be determined shortly) in your account on sunlab.cse.lehigh.edu. The name of your account is the same as your network server id. At the time of the deadline, email will be sent to you either confirming that the file has been collected or stating that the file has not been collected.

You should include some documentation for clarification. Your program should at least have identifying information stating the author, the course, the assignment, and the date: /* CSE 17 Your name Your user id Program Description: Program #1 DEADLINE: January 21, 2013, 11:00PM */