Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Arrays Artistic Solutions wants to keep track of 100 of customers, including the

ID: 3801290 • Letter: A

Question

Arrays

Artistic Solutions wants to keep track of 100 of customers, including the following fields:

Customer ID

Last Name

First Name

Street Address

City

State

Zip Code

Phone Number

Email Address

Without access to a database program, you decide that keeping this information in one or more arrays is the best solution. The question is, what kind or kinds of arrays would you use? Discuss whether any or all of the following is suitable for this application, indicating why you would or would not use this kind of array:

A single array for all customers and all fields

Parallel arrays (what would you store in the different arrays?)

Multi-dimensional arrays (what you you store in the different dimensions?)

Can you answer the three questions in bold?

Explanation / Answer

A single array for all customers and all fields
A single array is not a good option here.
Each customer has multiple fields, and you want to store the data of multiple customers,
so, using a single array for all customers and all fields is not suitable for this application.
Where as, if you insist, you can create a structure for each customer with the above fields,
and then you can use an array of 100 customers. But this doesn't mean using single array for
all customers and all fields.

Parallel arrays (what would you store in the different arrays?)
This works perfectly. For each field, you should create an array of 100 elements.
And accessing the data of ith customer simply means accessing the details of ith element
in each array you created. This is the best option of the three available, if you're not
into structures/linkedlists.

Multi-dimensional arrays (what you you store in the different dimensions?)
Multi-dimensional arrays is not an advisable option here. There problem is that, each
field may have its own datatype, like lastname, and firstname may have string datatype,
and zipcode, and customerID may have integer datatype. etc. In that case, the drawback of
arrays is that, it can store only similar type data, and different type of data cannot be
stored in arrays, and will not work here.
Whereas, if you are going to store all the data/fields in the same type assume string
(which is not a usual case), then multi-dimensional is much better than the previous option
parallel arrays.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote