Visual Basic Rule Of 72 Program Management

2020. 2. 20. 08:44카테고리 없음

I need some help with a Rule of 72 program I am working on. Having trouble displaying correct output for actual double time. Current code seems work for displaying interest, rule of 72 doubling time, but the actual doubling time seems to have both the incorrect formula and the wrong loop structure.

Visual Basic Rule Of 72 Program Management

Please lend any assistance possible. Thanks for your help. Option Explicit On Option Strict On Public Class frmRuleOf72 'Declare class level variable to use throughout form.

A place to discuss, ask questions and share ideas regarding the Visual Basic programming languages. Tips & Guidelines. Please prefix your posts with the version of Visual Basic you are using. Example: VB2010 - VB2015, VB6, VBSCRIPT, VBA.

Visual Basic Programs Examples

Posting any code you have will help others better understand what you are trying to do and what you have tried already, even if it doesn't work properly. It also shows that you already tried to solve your problem.

If you ask for help, you should come back and let us know how things turned out. Please up vote anybody who helps with your submission, we want people to keep answering questions. Homework questions are tolerated, please be specific about the question as much a possible. Asking us to write it for you is not going to happen. We also reserve the right to not answer if we think you are just not trying. Tell us what you have tried, to help us give better answers? Communities.

Visual Basic Rule Of 72 Program ManagementVisual

Resources. Learning Visual Basic.

Related Subreddits. I'm a complete beginner and could use a hand troubleshooting this code for class. The assignment is: 'The rule of 72 is used to make a quick estimate of the time required for prices to double due to inflation. If the inflation rate is r percent, the the Rule of 72 estimates the price will double in 72/r years. For instance, at an inflation rate of 6 percent, prices double in about 72/6 or 12 years. Write a program to test the accuracy of this rule.

The program should display a table showing, for each value of r from 1 to 20, the rounded value of 72/r, and the actual number of years required for the prices to double at an r percent inflation rate.(Assume prices increase at the end of each year.)' The rule of 72 part is pretty straight forward, but I'm having trouble with the second part, the 'actual years' it takes prices to double. I'm pretty sure this is just compound interest, but I don't think my second loop is working right.

Here is my code: Public Class Form1 Private Sub Button1Click(sender As Object, e As EventArgs) Handles Button1.Click Dim StartValue As Integer = 1 Dim Rate As Double Dim ActualYears As Integer = 1 Dim CurrentValue As Double = 1 For Rate = 1 To 20 Dim Ruleof72 As Integer = 72 / Rate Do While CurrentValue. Your equation to calculate CurrentValue is wrong. Sadly i cant tell you the exact mistake but i see StartValue is 1 and you add more than 1 to it in the first loop, so after the first loop CurrentValue is always 2 and it stops. Edit: may be able to help you Edit: From the linked source some interesting trivia: One of the highest inflation rates ever measured occurred during the Hyperinflation in the Weimar Republic, a democratic ancestor of the Federal Republic of Germany. The monthly (!) inflation rate reached a fantastical value of r = 295 = 29500%. To grasp this, it is certainly helpful to express it in form of the doubling time.

N = ln(2) / ln(296) = ca. 0.12 months = ca.

4 days. I think there are two problems. I don't doubt that my math is wrong.

Programming In Visual Basic Pdf

However the other problem is that it is still giving the same answer for every instance of Rate. I have changed it to: For Rate = 1 To 20 Dim Ruleof72 As Integer = 72 / Rate Do While CurrentValue.