Problem 151
Parallel Arrays
Create three arrays to store data about five people. The first array should be Strings and should hold their last names. The next array should be doubles and should hold a grade average (on a 100-point scale). The last array should be ints, should hold their student id numbers.
Give each of the arrays values (using array initializers). Then print the values of all three arrays on the screen.
Finally, ask the user for an ID number to lookup. Search through the ID array until you find that ID, and then print out the values from the same slot number of the other two arrays.
Values: Mitchell 99.5 123456 Ortiz 78.5 813225 Luu 95.6 823669 Zimmerman 96.8 307760 Brooks 82.7 827131 ID number to find: 307760 Found in slot 3 Name: Zimmerman Average: 96.8 ID: 307760
◄ 150: Pre-populating Arrays 152: Tic-Tac-Toe ►
Adapted from ProgrammingByDoing.com
©2013 Graham Mitchell
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.