Computer Science 523
Advanced Programming

Summer 2014, The College of Saint Rose

Lab 5A: Arrays and Java Swing
Due: 4:30 PM, Tuesday, June 24, 2014

This is the first of two new labs to come out this week. In this one, you will get some practice with arrays and Java Swing components, which will help you to prepare for the larger lab assignment that will be due the following week.

You may work alone or with a partner on this lab. Only one submission per group is needed.

Getting Set Up

To get your BlueJ environment set up for this week's lab assignment, start BlueJ and choose "New Project" from the "Project" menu. Navigate to your folder for this course and choose the name "Lab5A" (no spaces) for the project.

Create a document where you will record your answers to the lecture assignment and lab questions. If you use plain text, call it "lab5A.txt". If it's a Word document, you can call it whatever you'd like, but when you submit, be sure you convert it to a PDF document "lab5A.pdf" before you submit it.

Lecture Assignment Questions

We will usually discuss these questions at the start of class on the lab due date, so no credit can be earned for late submissions of lecture assignment questions.

LA Question 1: Write a method that takes an array of double values as its parameter and returns the sum of all elements in the array. (3 points)

LA Question 2: Write a method that takes an array of String values as its parameter and returns an array of int that contains the lengths of those Strings. That is, each element in the returned array contains the length of the String in the corresponding element of the parameter array. (4 points)

LA Question 3: Gaddis Algorithm Workbench exercise 5, p 532. (3 points)

LA Question 4: The popular Sudoku puzzle game consists of a board that has 9 rows and 9 columns of numbers ranging from 1-9. Suppose we are writing a class to store a Sudoku board. We will assume that filled-in entries contain a number 1 through 9, and blank entries are represented by 0.

Practice Programs

Practice Program: Your task is to add some functionality to the Matrix2D example and write code to test it in the main method there. The functionality you are to add:

Practice Program: Gaddis Programming Challenge 1, p. 448. Write this as a JApplet rather than a GUI application. (5 points)

Submitting

Before 4:30 PM, Tuesday, June 24, 2014, submit your lab for grading. There are two things you need to do to complete the submission: (i) Copy your file with the answers to the lecture assignment and lab questions into your project directory. Be sure to use the correct file name. If you prepared your answers in Word, export to a PDF file and submit that. (ii) Upload a copy of your lab (a .7z or .zip file containing your project directory) using Submission Box under assignment "Lab5A".

Grading

This assignment is worth 45 points, which are distributed as follows:

> FeatureValueScore
Lecture Assignment Quetions 20
Matrix2D max method 4
Matrix2D scale method 4
Matrix2D multiply method 7
Matrix2D main method enhancements 5
Programming Challenge 1 5
Total 45