This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Calculator{ | |
addition(num1: number, num2: number) { | |
return num1 + num2; | |
} | |
isGreeter(num1: number, num2: number): boolean { | |
return num1 > num2; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function multiply(a: number, b: number): number { | |
return (a*b); | |
} | |
export function calculatePercentage(part: number, total: number): string { | |
if (total > 0 && part > 0) { | |
const percentage = (part / total) * 100; | |
return `${percentage.toFixed(2)}%`; | |
} | |
return "Input contains negative number." |