Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a new PHP script and define the following two-dimensional array: $products = [ [ 'type' => 'electronics', 'name' => 'Audio Technica ATH-M50x', 'price' =>

Create a new PHP script and define the following two-dimensional array:

$products = [ [ 'type' => 'electronics', 'name' => 'Audio Technica ATH-M50x', 'price' => 119.99, 'quantity' => 2 ], [ 'type' => 'electronics', 'name' => 'Sennheiser HD 202 II', 'price' => 24.50, 'quantity' => 5 ], [ 'type' => 'electronics', 'name' => 'GPX HM3817DTBK Micro System', 'price' => 135.99, 'quantity' => 1 ], [ 'type' => 'electronics', 'name' => 'Samsung MX-J630 2.0 Channel 230 Watt System', 'price' => 117.99, 'quantity' => 4 ], [ 'type' => 'electronics', 'name' => 'M-Audio Bass Traveler', 'price' => 29.00, 'quantity' => 9 ], [ 'type' => 'electronics', 'name' => 'HLED Strip light kit', 'price' => 17.95, 'quantity' => 5 ], [ 'type' => 'movies', 'name' => 'Spectre', 'price' => '19.99', 'quantity' => 0 ], [ 'type' => 'movies', 'name' => 'Finding Dory', 'price' => 19.99, 'quantity' => 4 ], [ 'type' => 'movies', 'name' => 'Terminator: Genisys', 'price' => 14.95, 'quantity' => 3 ], [ 'type' => 'movies', 'name' => 'Interstellar', 'price' => 12.00, 'quantity' => 4 ], [ 'type' => 'movies', 'name' => 'Transformers: Age of Extinction', 'price' => 9.95, 'quantity' => 7 ], [ 'type' => 'movies', 'name' => 'Eye in the Sky', 'price' => 14.95, 'quantity' => 6 ], [ 'type' => 'movies', 'name' => 'Venom', 'price' => '22.99', 'quantity' => 0 ], [ 'type' => 'movies', 'name' => 'The spy who dumped me', 'price' => 29.00, 'quantity' => 8 ], [ 'type' => 'movies', 'name' => 'Mamma Mia, Here We Go Again', 'price' => 22.99, 'quantity' => 4 ], [ 'type' => 'electronics', 'name' => 'M-Audio Bass Traveler', 'price' => 29.00, 'quantity' => 5 ], [ 'type' => 'video-games', 'name' => 'Battlefield 1', 'price' => 59.99, 'quantity' => 3 ], [ 'type' => 'video-games', 'name' => 'Overwatch', 'price' => 40.00, 'quantity' => 1 ], [ 'type' => 'video-games', 'name' => 'Gears of War 4', 'price' => 59.99, 'quantity' => 8 ], [ 'type' => 'video-games', 'name' => 'Titanfall 2', 'price' => 59.99, 'quantity' => 7 ], [ 'type' => 'video-games', 'name' => 'Sid Meier\'s Civilization VI ', 'price' => 59.99, 'quantity' => 4 ], [ 'type' => 'video-games', 'name' => 'The Sims 4', 'price' => 39.99, 'quantity' => 2 ], [ 'type' => 'video-games', 'name' => 'Grand Theft Auto V', 'price' => 59.99, 'quantity' => 7 ] ];

Display the following information:

1. name, type, and price of each product.

2. name, type, and price of each product with a price greater than 30.

3. name, type, and price of each electronics item with a price greater than 30.

4. Revenue generated by each product is calculated by multiplying price and quantity: revenue = price * quantity. Display the revenue generated by each item ( display name, price, quantity, revenue) and the total revenue.

5. Find the revenue generated by electronics items (display name, type, price, quantity, revenue).

Submit a single PHP code that generates output for each of the five parts.

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

Repairing And Querying Databases Under Aggregate Constraints

Authors: Sergio Flesca ,Filippo Furfaro ,Francesco Parisi

2011th Edition

146141640X, 978-1461416401

More Books

Students also viewed these Databases questions