logotransparent.png

Legion of Learners

www.lol-101.com

  • Home

  • Classrooms

  • Courses

  • About Us

    • Executive Team
    • Board Members
  • Resources

  • More

    Use tab to navigate through the menu items.
    To see this working, head to your live site.
    • Categories
    • All Posts
    • My Posts
    sfolax6776
    Jul 08, 2019
      ·  Edited: Aug 29, 2019

    6.7 What are parallel arrays?

    in Introduction to Java

    A. Introduction

    You have done plenty of work with student height. In reality, we also need to process other information of students such as their name, address, grades etc. As an example, lets think about student weight. Can we save height and weight data in a 2-D array? If you tried, you will realize it doesn't work - 2-D arrays still store only 1 piece of data. The way to locate that piece of data is two dimensional, not two pieces of information such as height and weight.


    So, we have to create two arrays, one for height, one for weight. These two arrays are "parallel" because elements at the same index store the info regarding to the same student. How to make sure the data in two parallel arrays are "in sync"?


    B. Watch ... ( Slides )

    C. Now, can you

    1. Create 3 arrays to store 5 students name, gender and GPA.

    2. Print out a data table to display the above info.

    0 comments
    0
    0 comments

    Questions? Email us at legionoflearners@gmail.com or join our WeChat group!

    • lol-101dotcom

    ©2020 Legion of Learners