Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/Anni299/FinVeda
Browse files Browse the repository at this point in the history
  • Loading branch information
Anni299 committed Aug 2, 2024
2 parents d122b2a 30acc5a commit d417d7a
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tools/gdp.js
Original file line number Diff line number Diff line change
@@ -0,0 1,27 @@
document.addEventListener('DOMContentLoaded', () => {
const form = document.getElementById('GDPcalc');
const resultElement = document.getElementById('gdp-result');

form.addEventListener('submit', (event) => {
event.preventDefault();

// Get input values
const personalConsumption = parseFloat(document.getElementById('personal').value);
const grossInvestment = parseFloat(document.getElementById('investment').value);
const governmentConsumption = parseFloat(document.getElementById('consumption').value);
const exports = parseFloat(document.getElementById('exports').value);
const imports = parseFloat(document.getElementById('imports').value);

// Calculate GDP
const gdp = personalConsumption grossInvestment governmentConsumption exports - imports;

// Display the result
resultElement.textContent = `GDP: $${gdp.toFixed(2)}`;
});

form.addEventListener('reset', () => {
// Clear the result when the form is reset
resultElement.textContent = '';
});
});

50 changes: 50 additions & 0 deletions tools/sip.html
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 875,57 @@ <h5>Result:</h5>
<!-- expenditure and saving Calculator ends here -->


<!-- GDP calculator starts from here -->

<div class="header">
<h3>GDP Calculator</h3>
</div>

<div class="page-container shadow p-5 mb-5 bg-white rounded mt-5" id="GDPcalculator">
<div class="row">
<div class="col-md-6 offset-md-3">
<form id="GDPcalc" style="display: flex; flex-direction: column; justify-content: center; align-items: center;">
<fieldset>
<legend>Expenditure Approach</legend>
<div class="form-group">
<label for="personal" class="cost">Personal Consumption:</label>
<input type="number" id="personal" class="form-control" required>
</div>
<div class="form-group">
<label for="investment" class="selling-price">Gross Investment:</label>
<input type="number" id="investment" class="form-control" required>
</div>
<div class="form-group">
<label for="consumption" class="cost">Government Consumption:</label>
<input type="number" id="consumption" class="form-control" required>
</div>
<div class="form-group">
<label for="exports" class="selling-price">Exports:</label>
<input type="number" id="exports" class="form-control" required>
</div>
<div class="form-group">
<label for="imports" class="cost">Imports:</label>
<input type="number" id="imports" class="form-control" required>
</div>
<div class="buttons">
<button type="submit" class="btn btn-calculate">Calculate</button>
<button type="reset" class="btn btn-secondary">Clear</button>
</div>
</fieldset>
</form>
<div id="result" class="mt-3">
<h5>Result:</h5>
<p id="gdp-result"></p>
</div>
</div>
</div>
</div>

<script src="gdp.js" defer></script

<script src="gdp.js"></script>

<!-- GDP calucltor end here -->



Expand Down

0 comments on commit d417d7a

Please sign in to comment.