-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added future value of money view and functionality
- Loading branch information
1 parent
e53aabc
commit 069ca26
Showing
9 changed files
with
2,189 additions
and
2,074 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export class FutureValue { | ||
present: number; | ||
years: number; | ||
rate: number; | ||
compound: number; | ||
futureValue: string; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<h3>Future Value of Money</h3> | ||
<div class="columns"> | ||
<div class="column"> | ||
<div class="field"> | ||
<label class="label">Present Value</label> | ||
<div class="control"> | ||
<input (keyup)="calulateFutureValue()" [(ngModel)]="FutureValue.present" class="input" type="text"> | ||
</div> | ||
</div> | ||
<div class="field"> | ||
<label class="label">Years</label> | ||
<div class="control"> | ||
<input (keyup)="calulateFutureValue()" [(ngModel)]="FutureValue.years" class="input" type="text"> | ||
</div> | ||
</div> | ||
<div class="field"> | ||
<label class="label">Compound Type</label> | ||
<div class="select"> | ||
<select (change)="calulateFutureValue()" [(ngModel)]="FutureValue.compound"> | ||
<option value="0">Please Select Compound Type</option> | ||
<option value="1">Anually</option> | ||
<option value="2">Semianually</option> | ||
<option value="3">Quarterly</option> | ||
<option value="12">Monthly</option> | ||
</select> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="column"> | ||
<h1>Cold Hard Cash</h1> | ||
<h3>{{ FutureValue.futureValue }}</h3> | ||
</div> | ||
<div class="column"> | ||
<p> | ||
Cash flow is a movement of money in and out of a businesses, projects, or | ||
investments. It can be used to also calculate the internal rate of return or | ||
the net present value. Cash flow gives insight to a businesses liquidity, | ||
being profitable does not equally compare to a companies liquid assets. | ||
</p> | ||
</div> | ||
</div> |
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { FutureValueComponent } from './future-value.component'; | ||
|
||
describe('FutureValueComponent', () => { | ||
let component: FutureValueComponent; | ||
let fixture: ComponentFixture<FutureValueComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ FutureValueComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(FutureValueComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { FutureValue } from '../future-value' | ||
|
||
@Component({ | ||
selector: 'app-future-value', | ||
templateUrl: './future-value.component.html', | ||
styleUrls: ['./future-value.component.scss'] | ||
}) | ||
export class FutureValueComponent implements OnInit { | ||
|
||
FutureValue: FutureValue = { | ||
present: 0, | ||
years: 0, | ||
rate: 0, | ||
compound: 0, | ||
futureValue: '$ 0' | ||
} | ||
|
||
calulateFutureValue(event: any) { | ||
console.log('here') | ||
const rate = this.FutureValue.years / 100 | ||
const numberOfPeriods = this.FutureValue.years * this.FutureValue.compound | ||
const rateOfReturn = rate / this.FutureValue.compound | ||
console.log('rate', rate, 'number of periods', numberOfPeriods, 'rate of return', rateOfReturn); | ||
|
||
this.FutureValue.futureValue = '$ ' + (this.FutureValue.present * Math.pow( ( 1 + rateOfReturn ), numberOfPeriods ) ).toFixed(2) | ||
// if (this.FutureValue.futureValue === '$ NaN') { | ||
// this.FutureValue.futureValue = '$ 0' | ||
// } | ||
console.log(this.FutureValue.futureValue) | ||
} | ||
|
||
constructor() { } | ||
|
||
ngOnInit() { | ||
} | ||
|
||
} |