Archive for February 25th, 2008




9.7

1. A table of numbers, can be implemented as a two-dimensional array.2. if an application required the variable tale references an array of four  elements. Each of these elements in turn references an array of five integers.  These application will need to use two dimensional array. 

Add comment February 25, 2008

9.6

1. Parallel arrays can be achieved by using two arrays in which corresponding elements are related.2. In this example, the parallel arrays are both full and the loops use the instance variable length. 3. String [] name = new String[50]int [] age = new int [50]int [] security = new int [50]String searchPerson;int correspondingAge = -1, correspondingSecurity = -1searchName = …for (int i = 0, i<name.length; i ++) if (searchName.equal (name[i]))correspondingAge = age [i]correpondingSecurity = security [i]break;}4.5.       array should contain the exponent and the other array should contain 2 raised to that power.

– int[] exponent = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};

int[] powers = new int[10];

for (int i = 0; int < 10; i++){

power [i] = math.pow(2, exponent[i])

} ;

 

 

Add comment February 25, 2008

9.5

 1.The programmer will try to solve the problem by tracking the array’s logical size with a separate integer variable.

2. When the array is not full,one must replace the array’s physical length with it logical size of loop.

 


 

Add comment February 25, 2008

Pages

Categories

Links

Meta

Calendar

February 2008
M T W T F S S
« Jan   Apr »
 123
45678910
11121314151617
18192021222324
2526272829  

Posts by Month

Posts by Category