Activity 5 - Feb 9, 2026
Submitted by Brendan Morrissey
All About Arrays
After graduating from GGC, I want to buy a BMW or a Lamborghini.
Using a for loop to print out the names of my friends:
Friend number 0 is Mike
Friend number 1 is Jeff
Friend number 2 is Sarah
Friend number 3 is Susan
Friend number 4 is Joshua
Associative Array
Using a foreach loop to print out the names of my friends and their student IDs:
My friend Mike has student ID: GGC1234
My friend Jeff has student ID: GGC5678
My friend Sarah has student ID: GGC9012
My friend Susan has student ID: GGC3456
My friend Joshua has student ID: GGC7890
Define a 2nd Associative Array
The total weekly salary for all my friends is $2900
Find the friend with the highest weekly payment
The weekly salary for Mike is $400
The weekly salary for Jeff is $550
The weekly salary for Sarah is $600
The weekly salary for Susan is $650
The weekly salary for Joshua is $700
The friend with the highest weekly payment is Joshua with a weekly salary of $700
The friend with the lowest weekly payment is Mike with a weekly salary of $400
2D Array
Student 1: Student 2: Student 3: Student 4: Student 5: Student 1: - Name: Mike
- Age: 28
- Gender: Male
- Student ID: GGC1234
Student 2: - Name: Jeff
- Age: 32
- Gender: Male
- Student ID: GGC5678
Student 3: - Name: Sarah
- Age: 24
- Gender: Female
- Student ID: GGC9012
Student 4: - Name: Susan
- Age: 29
- Gender: Female
- Student ID: GGC3456
Student 5: - Name: Joshua
- Age: 31
- Gender: Male
- Student ID: GGC7890