Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { isFloat, isLength } from 'validator';
- import { GenderType } from '../common/gender-type';
- import { IShampoo } from '../../common/contracts/shampoo';
- import { UsageType } from './../common/usage-type'
- import { Product } from './generic-product';
- export class Shampoo extends Product implements IShampoo{
- private _milliliters: number;
- private _usage: UsageType;
- private readonly minNameLength: number = 3;
- private readonly maxNameLength: number = 10;
- private readonly minBrandLength: number = 2;
- private readonly maxBrandLength: number = 10;
- private readonly minPrice: number = 0;
- public constructor(name: string, brand: string, price: number, gender: GenderType, milliliters: number, usage: UsageType) {
- super(name, brand, price, gender);
- this._milliliters = milliliters;
- this._usage = usage;
- }
- public get milliliters(): number {
- return this._milliliters;
- }
- public get usage(): UsageType {
- return this._usage;
- }
- // Think about how to extend the print method ---> better method
- public print(): string {
- return super.print() + `#Milliliters: ${this.milliliters}\r\n #Usage: ${UsageType[this.usage]}\r\n ===`;
- // tslint:disable-next-line:max-line-length
- }
- }
Add Comment
Please, Sign In to add comment