Wednesday, April 11, 2012

Remove String

Today's mishap of the day:

Dim newSentence As Char
versus
Dim newSentence As String

That was all it took to make the program mess up. Head-shaking. The program's objective is to, given a sentence and a phrase to remove from that sentence, remove that phrase. For example, if you type "I dislike vegetables," and remove "dis," the new statement should read "I like vegetables." The error above meant only "I" showed up in the new statement.

Tuesday, April 10, 2012

CD Calculator

This calculates the number of years for an initial investment to accumulate (thanks to interest) to a certain amount based on given initial amount, final amount, and interest rate.

A few things I learned from this:

a) When setting up a counter, define an initial value for the counter.
years=0
years += 1

b) Argh! Use decimal format for interest rate. It's much more logical.

c) Check signs (ie greater than versus less than).