The calculation.ts module will be responsible for housing calculation methods. Initially, we need to implement two methods: discountOnPrice and discountedPrice. These methods will take in two parameters, the price and the discount, and return the corresponding values.
discountOnPrice(price: number, discount: number): number: This method should calculate the discount amount based on the original price and discount percentage.
discountedPrice(price: number, discount: number): number: This method should calculate the discounted price based on the original price and discount percentage.
Additionally, please include test implementations for these methods to ensure their correctness and reliability.
The
calculation.ts
module will be responsible for housing calculation methods. Initially, we need to implement two methods:discountOnPrice
anddiscountedPrice
. These methods will take in two parameters, theprice
and thediscount
, and return the corresponding values.discountOnPrice(price: number, discount: number): number
: This method should calculate the discount amount based on the original price and discount percentage.discountedPrice(price: number, discount: number): number
: This method should calculate the discounted price based on the original price and discount percentage.Additionally, please include test implementations for these methods to ensure their correctness and reliability.