CS 111A Lecture Notes - Arrays - Chapter 6

Arrays (One Dimensional)

Multidimensional Arrays

  • PixelDrawing.java: Solution to exercise #5.
  • In-class exercise #6: Modify the JaggedArray.java program above so that it outputs the average grade in each course, and also shows which course has the highest average grade.
  • JaggedAverage.java: solution to exercise #6.
  • In-class exercise #7: Write a program that inputs numbers on the command line, and then displays all of them except the highest one. Use a for each loop at least once in your program. For example:
     for(double num : numArray)
    Here is some sample output:
    [cpersiko@fog cs111a]$ java RemoveMax 98.5 74.2 105 55 98 88
    Here are the numbers you entered, with the maximum removed:
    98.5 74.2 55.0 98.0 88.0
    [cpersiko@fog cs111a]$ java RemoveMax 10 9 8 7 6 5 4 3 2 1 0
    Here are the numbers you entered, with the maximum removed:
    9.0 8.0 7.0 6.0 5.0 4.0 3.0 2.0 1.0 0.0
    
  • Solution to exercise #7: a program that inputs numbers on the command line and then displays all of them except for the max

    Return to the main CS 111A page