Assignment 3 1 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...

1 answer below »
The assignment description is in the file(s) I'm linking. So use those as your guide on what exactly to do. This is a very short assignment. I want it to be completely unique!!


Assignment 3 1 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', 2 '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', 3 '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. You may use a loop for each part or use a single loop to extract data to generate each output. You may use functions to organize your code. 4 You may use the "Example: Use a table to display array elements" document as a guide to create a sample output similar to the following: Example 1: Enrollment Data CourseEnrolledCapacity "; /* Each element( $course ) is an array. Use a loop to append table cells to $tRow string using elements of the $course array. */ foreach($course as $c) { $tRow .= "".$c." "; } // close the tr element $tRow .= ""; // Display table row echo $tRow; } ?> Example 2: Semester Plan "COMPSCI", "course" => 382, "credits" => 3, "category" => "Elective"], ["subject" => "COMPSCI", "course" => 223, "credits" => 3, "category" => "Core"], ["subject" => "MATH", "course" => 250, "credits" => 5, "category" => "Unique"] ]; ?> SubjectCourse#CreditsCategory "; /* Each element $s is an associative array. Use a loop to append table cells to $tRow string using elements of the array $s. */ foreach($s as $key => $value) { $tRow .= "".$value." "; } // close the tr element $tRow .= ""; // Display table row echo $tRow; } ?>
Answered 1 days AfterSep 17, 2021

Answer To: Assignment 3 1 Create a new PHP script and define the following two-dimensional array: $products = [...

Arun Shankar answered on Sep 19 2021
140 Votes
'electronics',
'name' => 'Audio Technica ATH-M50x',
'price' => 119.99,
'quantity' => 2 ],
[
'type' => 'electroni
cs',
'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' =>...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here