Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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: image text in transcribedHTML & 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional IPhone And IPad Database Application Programming

Authors: Patrick Alessi

1st Edition

0470636173, 978-0470636176

More Books

Students also viewed these Databases questions

Question

What are negative messages? (Objective 1)

Answered: 1 week ago