Algorithms and OOD (CSC 207 2014S) : EBoards

CSC207.01 2014S, Class 06: Arrays in Java


Overview

Preliminaries

Admin

Questions on the homework

How would you test reverseInts?

Here's one simple test.

int[] original = new int[] { 1, 2, 3, 4, 5 };
int[] expected = new int[] { 5, 4, 3, 2, 1 };

reverseInts (original);
assertArrayEquals ("onetwothreefourfive", expected, original);

But I'd probably use loops to build and fill the arrays so that I can get different size arrays.

Questions on the reading

How do I build a new array?

assertArrayEquals ("onetwothreefourfive", new int[] { 5, 4, 3, 2, 1} , original);

Detour: Writing Classes

ADT Design

Three basic questions for every ADT

N basic questions for every data structure

Detailed questions that come later

Lab

Copyright (c) 2013-14 Samuel A. Rebelsky.

Creative Commons License

This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.