Blog o’ Will Cook for Food
Not just another Wordpress blog

9.1-9.4

9.1.1

With an array, all of the variables can be processed as a group, instead of individually.

9.1.2

to access an item in an array, type

nameofarray[number_of_item]

9.1.3

Wages of the Week

5.23 = wages[0] – Monday

6.23 = wages[1] – Tuesday

6.83 = wages[2] – Wednesday

5.36 = wages[3] – Thursday

6.21 = wages[4] – Friday

9.2.1

a a[1] = 23

b a[a.length - 1] = 5-1 = 4

c a[2]-a[3] = 67-89 = -22

9.2.2

that number is out of bounds and will produce an error.

9.3.1

int x = 0

while (x < 5)

system.out.println(array[x])

x++

9.3.2

array goes from [0] to [5]

int x = 6

while (x > 0)

x–

system.out.print(array[x]

9.3.3

int index

index = 0

int i

i = -1

while (i <= 10){

i++

if xyz[i] < 0

index++

9.3.4

a. while i is less than the length of the array, increase i and find the absolute value of the element of the array corresponding to i.

b. while i is less than the length of the array, increase i. the string is the same value as the element a[i]

9.3.5

with length, you can easily find how many elements are in the array in total.

No Responses Yet to “9.1-9.4”

Leave a Reply