lab12-view - CSCI 203: Introduction to Computer Science I...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CSCI 203: Introduction to Computer Science I Bucknell University Computer Science Department http://www.eg.bucknell.edu/ ~ csci203 Lab 12: Arrays and Array Lists April 19–20, 2010 Table of Contents 1. Objectives 2. Preparation 3. Arrays 3.1. Exercise 1 Arrays of Primitive Types 3.2. Exercise 2 Arrays of Objects 3.3. Exercise 3 Reading into an Array 3.4. Exercise 4 Sorting Numbers 3.5. Exercise 5 Shuffling Cards 4. What to Submit 3 1. Objectives After completing the lab you should be able to 1. Use arrays in Java. References: The following references will be used throughout the lab. • CSCI 203 course website • Java API website • Chapter 7 of Big Java 2. Preparation Prepare for the lab by completing the following steps. 1. Start Eclipse. 2. Create a new Java project named lab12-xyz01 , where xyz01 is your login name. 3. Create the readme.txt file for this lab, insert the banner file with proper updates. 3. Arrays Arrays in Java are a collection of elements all of the same type or class. The size of an array is fixed when declared. For example, the following statement int x = new int [10]; Toc JJ II J I Back J Doc Doc I Section 3: Arrays 4 creates x , an array that can hold 10 integer values. One can access one of the elements by using an integer value or expression inside of square brackets. For example, the following adds 1 to x[3] . x[3] = x[3] + 1; Remember, the first element of the array has index 0. 3.1. Exercise 1 Arrays of Primitive Types Import the file UseArrays.java from ~ csci203/2010-spring/student/labs/lab12 This program compiles and runs but does not give the correct answer. Study the code and read the comments to see what the program is suppose to do. You are to complete the computed method....
View Full Document

Page1 / 8

lab12-view - CSCI 203: Introduction to Computer Science I...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online