Question
Language allowed to use: HTML & Javascript For the supermarket assignment, let's try to calculate that using code instead of just hardcoding the sum you'll
Language allowed to use: HTML & Javascript
For the supermarket assignment, let's try to calculate that using code instead of just hardcoding the sum
you'll cover loops in the next section but for now, how can you do it by just accessing the elements in Items ?
Using the object, access the elements in it to calculate the sum
Given a supermarket database that contains the following Items and their corresponding inventory count and price: Items Quantity Price Towels 20 $3.00 Milk 2 $2.00 Tissues 11 $1.00 Juice 6 $3.50 Utensils 12 $3.00 Cookies 10 $2.50 Bread 22 $3.00
1. Create a data structure (object) that encapsulates the supermarket database above. Hint: You will need to use nested objects. { a: {a1: 1, a2: 1}, b: {b1: 1, b2: 1}} 2. Using your data structure you created above, store the total quantity of all the items inside a variable called "totalQuantity".
3. Using your data structure you created above, store the total inventory value of all the items inside a variable called "totalValue".
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started