tax method

double tax(
  1. double percent
)

Applies a tax percentage to this number (adds percentage).

Example:

int price = 100;
double result = price.tax(10); // 110.0 (100 + 10%)

Implementation

double tax(double percent) => this * (1 + percent / 100);