seo-asif / Mastering-PHP-OOP-Assignment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mastering-PHP-OOP-Assignment

Online Shopping Cart System

In this project, I have implemented a Product class that represents a product in the online shopping cart system. The Product class has the following properties:

  • id (integer type): the unique identifier of the product.
  • name (string type): the name of the product.
  • price (float type): the price of the product.

In addition to the properties, the Product class should also have the following methods:

  1. __construct: a constructor method that takes the id, name, and price as parameters and initializes the corresponding properties of the object.

  2. getFormattedPrice: a method that returns the price of the product formatted as a string with two decimal places.

  3. showDetails: a method that prints the details of the product (id, name, and formatted price) to the console.

About


Languages

Language:PHP 100.0%