An array is a special type of data structure
that allows you to store multiple values in a single structure.

It is also a series of numbered memory locations with a shared
variable name.

The most basic way to store information is by using a variable.

Arrays are groups of related variables; these
variables are usually the same data type. Many programming languages
require arrays values to be of the same data type. However, Java
allows you to store different data types in the same array.

Using Multiple String Variables

// Until now we have used multiple
variables to store elements
// This is not very efficient and requires lots of code

The length property e.g., student.length
of the array class is used to count the number of elements that
have been stored in the array.

The loop iterates from 0 to one less than the length of the
array, because length is a count of the elements, not the greatest
index value.

Practice Assignment 7. 1- Getting
Started (Console)

Write programming statements to complete the following:

•Declare and initialize an array with seven different names

•Use a for loop to list the elements of the array in order
(starting with the element with the lowest index number)

•Use a for loop to list the elements of the array in reverse
order (starting with the element with the highest index number)

•Use a for loop to list the elements with even index numbers

•Use a for loop to list the odd index numbers

Putting Scanner Input into an Array

Getting Information from an Array

Assignment 7.2 - Marks (Console)

Create a program that asks how many students you have and then
uses a for loop to get their names and marks. Display the names
and marks as well as the class average, the highest mark and the
lowest mark.(Note: You may not use the sort function) Error check
to make sure that the mark is between 0 and 100 and that it is
an integer.

Hints: Use a for loop to calculate the highest mark. Create a
highmark variable and initialize it to 0. Each time through the
loop check if the current number > highmark. If it is set highmark
to the current value.

Do the same thing for lowmark (use the same loop) but initialize
lowmark to 100

Sorting Arrays

Assignment 7.3 - Random Stats

Create a RandomStats application that generates 200 random numbers
between 1 and 100, and then sorts them. The program must make
use of a second array of 5 counters to count how many numbers
fall into which category: 1 to 20, 21 to 40, 41 to 60, 61 to 80,
and 81 to 100. Use an if ......else if inside a for loop to add
1 to the Category everytime the number falls in the correct range.
(You do not need to use &&) Using a for loop print a "star-graph"
to represent how many of each number were in any given category.
You must use loops to print the graph. Do this with a nested for
loop instead of using separate loops.