Normal Topic calculating using percent (Read 521 times)
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
calculating using percent
Mar 23rd, 2007 at 11:06pm
Print Post Print Post  
Somebody please point out the obvious.  I know this should be simple I just am not seeing it at the moment. Embarrassed

I have a money field that is called TotalLoanAmount
I have a number field called StandardInterestRate

I just want to simply calculate yearly, monthly and daily (based on 30 day month) interest amount.

So I used this

YearlyInterestAmount  = (TotalLoanAmount * StandardInterestRate)
MonthleyInterestAmount = (YearlyInterestAmount / 12)
DailyInterestAmount = (MonthleyInterestAmount / 30)

In my test data I have $25,000.00 as TotalLoanAmount and 12 as StandardInterestRate (12%)

When my code runs I get
$300,000.00
$25,000.00
$833.33

Which is wrong.

When I change StandardInterestRate to  .12 (point 12) it works fine
$3000.00
$250.00
$8.33

The problem is I do not want it to look like .12% instead of 12%

What should I be doing to solve this problem without monkeying with data in Sbasic and adding the point during my calculation?

Thanks

  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: calculating using percent
Reply #1 - Mar 23rd, 2007 at 11:11pm
Print Post Print Post  
Before you calc with it, divide your interest rate by 100.

Also, if you are really paying 12% - renegotiate!
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: calculating using percent
Reply #2 - Mar 23rd, 2007 at 11:18pm
Print Post Print Post  
Thanks
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: calculating using percent
Reply #3 - Mar 23rd, 2007 at 11:49pm
Print Post Print Post  
Quote:
Before you calc with it, divide your interest rate by 100.


More specifically. Copy the element value to a variable of type double, and divide that by 100.0, and use the variable in your calculations. That way, the element can retain its value of 12., yet when used the value is .12.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged