Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialyige yang
8,329 Pointsquestions about orders@prices
what is the calculation behind the screen? When I did prices@orders, I get an array with several elements instead of one. However, prices is only a flattened array.
1 Answer
Jordan young
Courses Plus Student 5,277 PointsHi yige yang, I just went through this section, and noticed that your order set is incorrect. it should be orders@prices. The calculation of this is a whole mess of fast food orders (let's look back at the taco experiment.)
Array 1 [2, 0, 0, 0] ~This two represents tacos each a $1.50, which totals the first answer of the total array of $3. Array 2 [4, 1, 2, 2,] ~ This represents the 4 tacos 1 burrito, 2 horchatas and 2 mexican cokes. which equal the total of $20.50(so then this Array math is 1.50*4, 1 burrito *8 dollars, 2*1.25 horchatas, and 2*2 mexican cokes) Array 3 [0,1,0,1,]- 0 tacos, 1 burrito * 8 dollars, 0 horchatas, 1*2) equals $10. Array 4 [6. 0, 1, 2] - 6*1.50 tacos, 0 burritos, 1*1.25 horchatas, 2*2 mexican cokes for a total of 12.25
Hope this helps!