Before we start, did you try solving the workbook yourself?
If not, please click the link in the resources folder and follow the instructions for this workbook.
Welcome to Workbook 6.8.
Task one is to create an array that can store these string elements.
So we'll start with that, an array that can store elements of type strings.
What should we call it?
How about just apples is equal to.
The following values.
All right.
Create another area that stores the price of each apple.
Simple enough, that should be double.
An array that can store elements of type double.
Apparently I can't type.
Prices is equal to.
All right.
Task two is to use a four loop to print each apple and its price.
This is very simple because they both have the same length of three, so you can use either length to
set your condition in the for loop.
It doesn't matter.
So four and is equal to zero.
Heck, let's just say it is smaller than three plus plus.
You could have said here applesauce at length or you could have said prices length.
It doesn't really matter.
Let's go with three.
Actually, we've been given this print statement to be used in a for loop.
How convenient.
Here we print the apple at index I.
I should say, apples.
And here we print the price at index I.
Prices.
All right.
I think we are done.
Let's visualize the runtime.
My favorite part of every solution video.
Okay, So here we've got two arrays, both of them with three elements.
Our for loop is going to start at I equaling zero.
The apple at Index zero is gala, which has a price of 199.
Splendid.
I A-plus plus is going to increase I to one.
So in our second run I equals one.
The apple at index one is Granny Smith, which is worth a dollar 49.
Now A-plus plus increases I to two.
The apple at Index two is a macintosh, which equals a price of $1.29.
And now I plus plus increases I to three three is not smaller than three so the loop breaks.
And that's it.
Same output has learned the part.
That means we are good.
I hope you enjoyed yet again another break point session.