Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy

Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif

Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster

CTP, Sr Infrastructure Consultant

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting

Research

Professional Opinions

Ask a QuestionWe've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

I have a table with the the following columns

CustID CustName PrincipleAmount NumberOfYears DepositType

I have created a function that sets the principle rate

CREATE FUNCTION [dbo].[IntRate](@NumberofYears decimal(7,4))

RETURNS decimal(7,4)

AS

BEGIN

DECLARE @rate decimal(7,4)

if @NumberofYears>=20 set @rate ='.15'

else if @NumberofYears >= 11 set @rate ='.125'

else if @NumberofYears>= 6 set @rate ='.10'

else if @NumberofYears>= 4 set @rate ='.075'

else if @NumberofYears>= 1 set @rate ='.05'

else set @NumberofYears = '0'

RETURN @rate

END

no i need to be able to calculate the final amount taking variable from both of these tables

PROBLEM:

I am unclear how to call the variable from the function

problem trying to solve:

Final Amount (A) – Takes three inputs P, N, and Deposit Type and returns the final amount using either simple interest formula or compound interest formula, depending upon the deposit type. For the calculation of R it uses the rate of interest function.

formulas: A=PNR (for simple interest)

A=P(1+r)^N (for compound interest)

so i know i need an if statement based on the deposittype

I need to know how to get started or how to call the rate from the function.

Thanks

CustID CustName PrincipleAmount NumberOfYears DepositType

I have created a function that sets the principle rate

CREATE FUNCTION [dbo].[IntRate](@NumberofY

RETURNS decimal(7,4)

AS

BEGIN

DECLARE @rate decimal(7,4)

if @NumberofYears>=20 set @rate ='.15'

else if @NumberofYears >= 11 set @rate ='.125'

else if @NumberofYears>= 6 set @rate ='.10'

else if @NumberofYears>= 4 set @rate ='.075'

else if @NumberofYears>= 1 set @rate ='.05'

else set @NumberofYears = '0'

RETURN @rate

END

no i need to be able to calculate the final amount taking variable from both of these tables

PROBLEM:

I am unclear how to call the variable from the function

problem trying to solve:

Final Amount (A) – Takes three inputs P, N, and Deposit Type and returns the final amount using either simple interest formula or compound interest formula, depending upon the deposit type. For the calculation of R it uses the rate of interest function.

formulas: A=PNR (for simple interest)

A=P(1+r)^N (for compound interest)

so i know i need an if statement based on the deposittype

I need to know how to get started or how to call the rate from the function.

Thanks

Our community of experts have been thoroughly vetted for their expertise and industry experience.

The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.