Clase en TypeScript

export class Economica{ presente:number; tasa:number; periodo:number; constructor(presente:number, tasa:number, periodo:number){ this.presente=presente; this.tasa=tasa; this.periodo=periodo; } getCalculo(){ return Math.floor(this.presente*Math.pow(1+this.tasa/100,this.periodo)) } } import {Economica} from "./modelo/economica" const print = console.log let economica = new Economica(4500,0.08,4) print(economica) print("Valor presente:",economica.presente) print("Tasa:",economica.tasa) print("Periodo:",economica.periodo) print("Valor futuro:",economica.getCalculo())
Ejemplo de clase en TypeScript

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.