Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Typescript _ShareValue_Calculator The share value calculator calculates the net profit earned by a user from his/her shares using the data - his/her total share
1. Typescript _ShareValue_Calculator The share value calculator calculates the net profit earned by a user from his/her shares using the data - his/her total share units, price of each share when bought, current value of each share. Follow the instructions given in the file to write your code. Code is to be written in "index.ts " file. index.ts X 1 4 export interface shareDetails totalunits: number, priceperunit: number, currentvalue : number, getShareValueReturn(): any } 5 6 7 8 9 10 1/Define the class Investment that takes two parameters-'totalunits' and 'priceperun II and return the total investment through a function- 'calculateInvestment()' 11 12 13 14 export class Investment{ constructor(public totalunits; number, public priceperunit: number) { } 15 16 17 calculateInvestment(){ 18 19 } 20 } I 21 22 23 24 // Define the class 'ShareValue' that implements 'ShareDetails' interface // The class accepts 3 parameters- 'totalunits', 'priceperunit', 'currentvalue' // The function 'getshareValueReturn()' calculates the net profit using the calculate 25 26 dexts x 14 15 16 17 constructor(public totalunits: number, public priceperunit: number) { } calculateInvestment(){ 18 19 20 } // Define the class 'ShareValue' that implements 'shareDetails' interface // The class accepts 3 parameters- 'totalunits', 'priceperunit', 'currentvalue" // The function 'getShareValueReturn()' calculates the net profit using the calculate Investmen 21 22 23 24 25 26 27 28 29 30 31 32 export class ShareValue { constructor(public totalunits: number, public priceperunit: number, T|||| public currentvalue : number) { } getShareValueReturn(){ } I 33 34 35 36 } let shareone : ShareDetails; shareone = new ShareValue(15, 100, 250); 37 38
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started