Constructor
new Flower(id, name, price, image, color, stemLength)
Creates a Flower instance.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
number | ID. |
name |
string | Name. |
price |
number | Price. |
image |
string | Image path. |
color |
string | The color of the flower. |
stemLength |
number | The length of the stem in cm. |
- Source:
Extends
Classes
Methods
getDescription() → {string}
Returns a detailed description of the flower.
- Overrides:
- Source:
Returns:
Description including color and stem length.
- Type
- string
getId() → {number}
Gets the unique ID of the item.
- Overrides:
- Source:
Returns:
The item's ID.
- Type
- number
isPricy() → {boolean}
Checks if the item is expensive (price > 100).
- Overrides:
- Source:
Returns:
True if the price is above 100.
- Type
- boolean
isSuitableForTallVase() → {boolean}
Checks if the flower is suitable for a tall vase.
- Source:
Returns:
True if stem length is 40cm or more.
- Type
- boolean
Example
const rose = new Flower(1, 'Rose', 50, 'img.png', 'Red', 50);
rose.isSuitableForTallVase(); // returns true