Question: Language allowed to use: HTML & Javascript POST ANSWER IN CODE ONLY, USING HTML AND JAVASCRIPT. NOT AN EXPLANATION. Problem: For the supermarket assignment, let's

Language allowed to use: HTML & Javascript POST ANSWER IN CODE ONLY, USING HTML AND JAVASCRIPT. NOT AN EXPLANATION.

Problem:

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!