From 688d905b274dc34abe6875d2f73e31c6fc654078 Mon Sep 17 00:00:00 2001 From: Tisha Date: Mon, 3 Jun 2024 23:16:18 +0530 Subject: [PATCH] changes changes --- components/Blocks/CompoundInterest.jsx | 2 +- components/Blocks/EffectiveAnnualRate.jsx | 4 ++-- components/Blocks/SimpleInterest.jsx | 2 +- components/Blocks/UserData.jsx | 3 +-- components/data.js | 8 ++++---- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/components/Blocks/CompoundInterest.jsx b/components/Blocks/CompoundInterest.jsx index 0f1a8f7..1892167 100644 --- a/components/Blocks/CompoundInterest.jsx +++ b/components/Blocks/CompoundInterest.jsx @@ -10,7 +10,7 @@ import styles from "./BlockStyles.module.css"; function calCompoundInterest(Principal_amount, Annual_rate, Years, Times_compounded){ let ci; - ci = Principal_amount * (1 + Annual_rate / Times_compounded) ** (Times_compounded * Years); + ci = Principal_amount * (1 + (Annual_rate/100) / Times_compounded) ** (Times_compounded * Years); return ci.toFixed(2); } diff --git a/components/Blocks/EffectiveAnnualRate.jsx b/components/Blocks/EffectiveAnnualRate.jsx index db8dc9d..3fd76f5 100644 --- a/components/Blocks/EffectiveAnnualRate.jsx +++ b/components/Blocks/EffectiveAnnualRate.jsx @@ -8,7 +8,7 @@ import styles from "./BlockStyles.module.css"; function calsimpleinterest(Annual_rate, Times_compounded){ let ear; - ear = (1 + Annual_rate / Times_compounded)**Times_compounded - 1; + ear = (1 + (Annual_rate/100) / Times_compounded)**Times_compounded - 1; return ear.toFixed(2); } @@ -19,7 +19,7 @@ function EAR({userData}) {
- Effective Annual Rate : Rs {ear} + Effective Annual Rate : {ear} %
The Effective Annual Rate (EAR) reflects the actual annual return on an investment or the actual annual interest rate on a loan, accounting for compounding within the year.
diff --git a/components/Blocks/SimpleInterest.jsx b/components/Blocks/SimpleInterest.jsx index 5ff2b04..77a2add 100644 --- a/components/Blocks/SimpleInterest.jsx +++ b/components/Blocks/SimpleInterest.jsx @@ -9,7 +9,7 @@ import styles from "./BlockStyles.module.css"; function calsimpleinterest(Principal_amount, Annual_rate, Years){ let si; - si = Principal_amount * (1 + Annual_rate * Years); + si = Principal_amount * (1 + (Annual_rate/100) * Years); return si.toFixed(2); } diff --git a/components/Blocks/UserData.jsx b/components/Blocks/UserData.jsx index e0485aa..728949d 100644 --- a/components/Blocks/UserData.jsx +++ b/components/Blocks/UserData.jsx @@ -1,7 +1,7 @@ import { keys } from "../data"; function MeasurementScale({forr}) { - const key = keys.find(key => key.name === forr); // forr is [gender, age ,weight, height] + const key = keys.find(key => key.name === forr); if(key === undefined) return <>; return ( {key.scale} @@ -20,7 +20,6 @@ export function UserDataBlock({userData}) { { Object.keys(userData).map(( ObjKey, index)=>{ // console.log(ObjKey); - // object.keys == [Genders,height,weight,age]; return (
diff --git a/components/data.js b/components/data.js index 44069e4..a7299dd 100644 --- a/components/data.js +++ b/components/data.js @@ -1,15 +1,15 @@ export const keys = [{ - name: 'Principal_amount' , type: 'number' , scale : "years" + name: 'Principal_amount' , type: 'number' , scale : "Rs" },{ - name: 'Annual_rate' , type: 'number' , scale : "years" + name: 'Annual_rate' , type: 'number' , scale : "%" },{ name: 'Years' , type: 'number' , scale : "years" },{ - name: "Times_compounded" , type: "number" , scale: "years" + name: "Times_compounded" , type: "number" , scale: "" },{ name: 'Loan_term_years' , type: 'number' , scale : "years" },{ - name: 'Payments_made' , type: 'number' , scale : "years" + name: 'Payments_made' , type: 'number' , scale : "" } ]