View the step-by-step solution to:

Create a web application that simulates adding different types of products to a database using OOPand inheritance Create a base class called Product...

Create a web application that simulates adding different types of products to a database using OOPand inheritance

  • Create a base class called Product and save it in a PHP script called Product.php
  • Create properties for holding a title, description, and price
  • Create getters and setters for all the properties
  • Create a sub class called Tools that extends Product and save it in a PHP script called Tools.php
  • Create properties for holding a shipper (i.e. UPS, FedEx, USPS), and weight
  • Create getters and setters for all the properties
  • Create a sub class called Electronics that extends Product and save it in a PHP script called Electronics.php
  • Create a property for holding whether the electronic product is recyclable or not
  • Create getters and setters for the property
  • Create a PHP script called addProduct.php that will allow you to enter new product information into a form and save it to a database
  • You might want to have a selection control that will display a different form based on whether you are adding a generic product, a tool, or electronics to the database
  • Although you have a lot of flexibility, consider adding methods to the appropriate classes for handling the specific database insertions depending upon the product type
  • Although not required, you could even create separate methods in the different classes that handle the form entry depending upon the product type
  • Don't worry about creating separate tables for the different classes and using inner joins to link them. Just create one table that holds all the properties of the different classes. Keep in mind that some of the fields would be set to NULL if they don't apply to that particular product type.

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question