Question: Give me a eclipse PHP code to built an ecommerce application that will allow the ecommerce to have Products categories ( clothing , electronics, and
Give me a eclipse PHP code to built an ecommerce application that will allow the ecommerce to have Products categoriesclothing electronics, and books and ongoing category discounts
percentage off that apply to all products within that category.
NB: The PHP excecutable is linked to ampps php exe
Product Class:
name stringprice floatquantity integer
Category Class:
name stringdiscount float percentage between and
DiscountedProduct Class: This class should inherits from the Product class with the following additional property:
category object of the Category class
Multidimensional Array: Create a multidimensional array named $products where the first dimension represents categories keys are category names and the second dimension is an array of DiscountedProduct objects belonging to that
category.
Discount Application: Have a function named calculateDiscountedPrice that
takes a DiscountedProduct object as input. It should calculate the final price after applying the category discount as follows:
Final price price category.discount
the output should iterate through the $product array and for each product and print the product information name original price,category,discount,and final price after discount
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
