CLS
'By Ian Fox
'November 21, 2006
'Some guys homework
DIM dblCurrentBalance AS DOUBLE 'The current balance
DIM sinInterestRate AS SINGLE 'The interest rate
DIM intInvestmentLength AS INTEGER 'How many years they are investing
DIM i AS INTEGER 'A temporary variable used for FOR LOOPing
DO
INPUT "How much money would you like to invest"; dblCurrentBalance
PRINT "You must enter a value greater then `0'."
LOOP UNTIL dblCurrentBalance > 0
CLS
DO
INPUT "What is the Interest rate on your investment"; sinInterestRate
PRINT "The interest rate must not be a negative number."
LOOP UNTIL sinInterestRate >= 0
CLS
DO
INPUT "How many full years would you like to invest"; intInvestmentLength
PRINT "The amount of years must be positive."
LOOP UNTIL intInvestmentLength > 0
CLS
'Okay, we have all of our values and hopefully due to some basic
'error checking, everything should turn out correctly.. or at least
'it should make sense.
PRINT "You start out with $"; dblCurrentBalance; "invested at an interest rate of "; sinInterestRate; "%."
sinInterestRate = sinInterestRate * .01 'Make the interest rate a decimal for multiplying
FOR i = 1 TO intInvestmentLength
dblCurrentBalance = dblCurrentBalance + (sinInterestRate * dblCurrentBalance)
PRINT USING "After year ### you have $ ###########.## invested."; i; dblCurrentBalance
NEXT i
Meh, I think I shouldn't have wrote this... but I was bored.