email me at borlaj@portlandschools.org

Loading
notes previous (10/<10) submit the dump links  
 

Array Activities in HWJ15_Arrays

 

In a method public void practiceArrayInts() do the following:

  1. Create an array size 10 of integers.
  2. Have it have the values 10,20,30,40,50 and so on.
  3. Print out all the numbers in the array.
  4. Find the sum of all the numbers in the array and print that out.//use a for loop
  5. Add 7 to every number in the array. //use a for loop
  6. [advanced] Print out the remainder when every number in the array is divided by 7.//use a for loop
  7. [advanced] Replace all values with random ints numbers between 1 and 100 and print it out
  8. [super adv] Sort the array

NOT HOMEWORK TONIGHT

In a method public void practiceArrayStrings() do the following: (

  1. Create an array with 3 names.
  2. Have it print out every name on its own line.
  3. Have it print out the length of each name ( ie Jeff -> 4 letters
  4. [advanced] Have it say how many times the letter e is in each name (ie Jeff-> 1 e) [hard, extra credit]
  5. Have it replace all the a and e with z.
  6. Have it print it out.
  7. [advanced]Have it say which word comes first alphabetically (use compareTo) [hard, extra credit)
  8. [advanced] Have it reorder the words alphabetically