Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
yige yang8,329 Points
questions 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.
Hi 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!