?
Solved

Exam coming up, I have questions I need help answering.

Posted on 2008-11-11
8
Medium Priority
?
193 Views
Last Modified: 2013-11-26
I have an upcoming exam and I don't have access to my professor and I have questions that the book is not clarifying for me.  The book that the class is using is Murach's Visual Basic 2008.

iI will list the questions will by numbers.  I understand that there are alot of questions here but I really need a good grade on this exam and these are the areas that I am still unsure of.  Some of the questions, I have tried to answer and I posted a comment in (), it my guess is correct could you annotate so.  If not could you help me get on base.

I am taking the exam tomorrow at 11.  I have been buried in this book for a couple of days now and I need help.  I am using this site as a last resort.  I figured individuals on here are much more proficient than myself so I mine as well ask the experts.  

I want to thank anyone in advance that is willing to answer any of these questions for me.  God Bless and Happy Veterans Day.  I myself am an "Iraq Veteran" in 2003.


1.  Here is the code, I understand what it does but I don't know how to apply it.  (example inputing in numbers).  I realize that default is 0.  But on the questions the professor will have this code and say input a number what would the answer be?  I don't know how to do that.

Input 3 as an example:

Dim sum As Integer
Dim i As Integer
For i = 0 to 4
      sum += i
Next

Answer?:

Same problem but different format.

Dim sum As Integer
Dim i As Integer = 2 to 12 Step 2
      sum += i
Next

Answer?:

Same problem but different format.

Dim sum As Integer
Dim i As Integer = 25 to -15 Step -10
    iSquared = i ^ 2      
    sum += iSquared
Next

Answer?:

For loop that calculates a future value
D
im monthlyInvestemnt As Decimal = 100
Dim monthlyInterestRate As Decimal = .01D
Dim months As Integer = 120
Dim futureValue As Decimal

For i As Integer = 1 To months
      futureValue = (futureValue + montlyInvestemnt) _
                      * (1 + monthlyInterestRate)
      Next i

Answer?:
0
Comment
Question by:nosurf2day
  • 5
  • 3
8 Comments
 
LVL 53

Expert Comment

by:Dhaest
ID: 22938183
Dim sum As Integer
Dim i As Integer
For i = 0 to 4
      sum += i
Next

--> answer: sum = 10   (0+1+2+3+4 )
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 22938194
       For i As Integer = 2 To 12 Step 2
            sum += i
        Next

sum = 42 (2+4+6+8+10+12)
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 22938206
      Dim sum As Integer
        Dim iSquared As Integer
        For i As Integer = 25 To -15 Step -10
            iSquared = i ^ 2
            sum += iSquared
        Next

Answer: sum =  1125    (625 + 225 + 25 + 25 + 225)    ((25 * 25) + (15*15) + (5*5) + (-5*-5) + (-15*-15))
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
LVL 53

Expert Comment

by:Dhaest
ID: 22938214
       Dim monthlyInvestemnt As Decimal = 100
        Dim monthlyInterestRate As Decimal = 0.01D
        Dim months As Integer = 120
        Dim futureValue As Decimal

        For i As Integer = 1 To months
            futureValue = (futureValue + monthlyInvestemnt) _
                            * (1 + monthlyInterestRate)
        Next i

FutureValue = 23233.907635194016983557338611D
0
 

Author Comment

by:nosurf2day
ID: 22938637
Thank you very much for the information, it is much easier than I though, I was looking at it the wrong way.  The last post though.

I am confused how you got this answer,  I am a business major, I understand the future value of money very well.  I understand what I am looking at for info.  But where did you come up with the amount?  The amount that I come up with on my financial calculator is this.

PPY:12
N:120
I: 10%
PMT: 100
FV: 20484.49

Regardless to the answer, am reading this right though?
0
 
LVL 53

Accepted Solution

by:
Dhaest earned 2000 total points
ID: 22938669
When I break the values in the loop, I get the following values:
Dim monthlyInvestemnt As Decimal = 100
i = 1    futurvalue = 101D
i = 2    futurevalue = 203.01D
i = 3    futurevalue = 306.0401D
i = 4    futurevalue = 410.100501D
i = 5    futurevalue = 515.20150601D
i = 6    futurevalue = 621.3535210701D
i = 7    futurevalue = 728.567056280801D
i = 8    futurevalue = 836.85272684360901D
i = 9    futurevalue = 946.2212541120451001D
i = 10    futurevalue = 1056.683466653165551101D
i = 11   futurevalue = 1168.25030131969720661201D
i = 12    futurevalue = 1280.9328043328941786781301D
...
i = 120 futurevalue = 23233.907635194016983557338611D
0
 

Author Closing Comment

by:nosurf2day
ID: 31515967
You rock, thanks alot!
0
 

Author Comment

by:nosurf2day
ID: 22940364
I get it now, thank you.  I was missing something.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month15 days, 18 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question