Pseudocode Problem


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Pseudocode Problem

Hybrid View

  1. #1
    Join Date
    Jan 2008
    Posts
    13

    Pseudocode Problem

    Hi

    can somone please help me with my pseudocode. i think its right, can you have look to make sure. its for an investment calculator:

    Form Unload:
    (Main Form)
    Begin Form Unload
    Unload Help form
    End form Unload
    Calculate Click:
    (Main Form)


    Begin Calculate Click:
    FV = Investors full name
    I = Growthrate
    N = Term in years
    PV = Initial Investment

    PV = FV / ((1 + i) ^ n)

    End Calculate Click

    Add to portfolio Click:
    (Main Form)
    Begin Add to portfolio Click:
    Make investment text box invisible
    Make term in years text box invisible
    Make growthRate text box invisible
    Make number investors text box visible
    Make initial number investments visible
    Set the focus to the investor name text box

    Clear Click:
    (Main Form)
    Begin Clear Click
    Clear name text boxes
    Set the focus to the investor name text box
    End Clear Click

    Add to club Click:
    (Main Form)
    Begin Add to club Click
    Make initial investment text box visible
    Make number investors text box visible
    Make initial number investments text box visible
    Set the focus to the investor name of the text box Set

    New investor Click:
    (Main Form)
    Begin New investor Click:
    Make NumberInvestors visible
    Make initial numberinvestments visible
    Set the focus to the investor name of the text box

    Club Summary Click:
    (Main Form)
    Begin Summary Click:
    Show the summary form
    End summary form

    Help Click:
    (Main Form)
    Begin Help Click
    Show the help form
    End help form

    Exit Click:
    (Main Form)
    Begin End Click:
    Ans = MsgBox(type 4)
    If Ans = 6
    Terminate program
    End if
    End Exit Click

    THIS IS MY CODE:

    Option Explicit

    Public PV As Double
    Public FV As Double
    Public Interestrate As Double
    Public n As Double 'Variables to be used
    Public Initial As Double
    Public Investments As Double
    Public Investors As Integer

    'Purpose

    'This program computes the initial investment for individual
    'club members and for the club as a whole. Having been given the
    'future goal, annual interest rate, and term in years, the initial investment
    'will be found and displayed.

    'Additionally, for multiple investments by a single investor, the number
    'of investments and their total value are computed and displayed.

    'Finally, the number of investors, their total and average initial investments
    'are displayed on a summary form

    Private Sub cmdAddtoclub_Click()
    mdlGlobal.Initial = mdlGlobal.Initial + Initial
    mdlGlobal.Investments = mdlGlobal.Investments + Investments 'Module been added, if investment to be
    mdlGlobal.Investors = mdlGlobal.Investors + 1 'added to club.

    cmdAddtoclub.Visible = True 'This button will be shown in program
    txtName.Text = ""
    txtInvestmentgoal.Text = ""
    txtGrowthrate.Text = ""
    txtTermyears.Text = ""
    txtInitialInvestment.Text = ""
    cmdportfolio.Visible = False 'This button won't be shown in program
    cmdClear.Visible = False ''This button won't be shown in program
    cmdAddtoclub.Visible = False ''This button won't be shown in program
    cmdNewinvestor.Visible = False ''This button won't be shown in program
    cmdSummary.Visible = True ''This button will be shown in program
    txtInitial.Text = ""
    txtNoinvestors.Text = ""
    lblNoinvestors.Visible = False 'This button won't be shown in program
    txtNoinvestors.Visible = False 'This button won't be shown in program
    lblInitial.Visible = False 'This button won't be shown in program
    txtInitial.Visible = False 'This button won't be shown in program
    txtName.SetFocus 'This set focuses the text box
    End Sub

    Private Sub cmdCalculate_Click() 'This calculates the interest and displays it in the initial
    FV = Val(txtInvestmentgoal.Text) 'investment text box.

    PV = Val(txtInitialInvestment.Text)
    i = Val(txtGrowthrate.Text) / 100
    n = Val(txtTermyears.Text)
    PV = FV / ((1 + i) ^ n) 'This is the calculation used to work out the investment.

    If PV = 0 Then
    MsgBox "Zeros not accepted, enter a bigger value", 48, "Error" ' This diplays a error message if you put in a zero.
    txtInvestmentgoal.Text = ""
    txtGrowthrate.Text = ""
    txtTermyears.Text = "" 'These are the buttons to be used where the values will be displayed.
    txtInitialInvestment.Text = ""
    txtInvestmentgoal.SetFocus
    Else

    txtInitialInvestment.Text = Format(FV / ((1 + i) ^ n), "Currency") ' This will display a currency, basically a pound sign
    PV = Format(FV / ((1 + i) ^ n), "Fixed")

    cmdportfolio.Visible = True

    End If

    End Sub

    Private Sub cmdClear_Click()
    txtName.Text = ""
    txtInvestmentgoal.Text = ""
    txtTermyears.Text = "" 'This will clear the text for the following buttons
    txtGrowthrate.Text = ""
    txtInitialInvestment.Text = ""
    lblNoinvestors.Visible = False 'This won't be shown in program once clicked clear
    txtNoinvestors.Visible = False ''This won't be shown in program once clicked clear
    lblInitial.Visible = False ''This won't be shown in program once clicked clear
    txtInitial.Visible = False ''This won't be shown in program once clicked clear
    cmdClear.Visible = False ''This won't be shown in program once clicked clear

    txtName.SetFocus 'Set focuses the name of the button
    End Sub

    Private Sub cmdExit_Click()
    Dim ans As Integer
    ans = MsgBox("Are you sure you want to quit?", vbYesNo + vbQuestion, "quit") 'This is the message to be displayed once clicked on exit
    If ans = vbYes Then 'If answer is yes, then it will quit the program
    End 'If answer is no, then the program will still run
    End If
    End Sub

    Private Sub cmdNewinvestor_Click() 'This button lets you make a new investment, with a blank screen given

    cmdAddtoclub.Visible = False ' This button won't be shown
    txtInitial.Text = ""
    txtNoinvestors.Text = ""
    lblNoinvestors.Visible = False 'This button won't be shown in program
    txtNoinvestors.Visible = False 'This button won't be shown in program
    lblInitial.Visible = False 'This button won't be shown in program
    txtInitial.Visible = False 'This button won't be shown in program
    txtName.Text = ""
    txtInvestmentgoal.Text = ""
    txtGrowthrate.Text = ""
    txtTermyears.Text = ""
    txtInitialInvestment.Text = "" 'This button won't be shown in program
    cmdClear.Visible = False
    txtName.SetFocus
    End Sub

    Private Sub cmdportfolio_Click() 'This button lets you add the investment to the portfolio of records
    Initial = Initial + PV
    Investments = Investments + 1
    txtNoinvestors.Text = Investments
    txtInitial.Text = Format(Initial, "Currency")
    cmdNewinvestor.Visible = True 'This button will be shown in program
    cmdAddtoclub.Visible = True ''This button will be shown in program
    cmdportfolio.Visible = False ''This button won't be shown in program
    lblNoinvestors.Visible = True 'This button will be shown in program
    txtNoinvestors.Visible = True 'This button will be shown in program
    lblInitial.Visible = True 'This button will be shown in program
    txtInitial.Visible = True 'This button will be shown in program
    txtInvestmentgoal.Text = ""
    txtGrowthrate.Text = ""
    txtTermyears.Text = ""
    txtInitialInvestment.Text = ""
    txtInvestmentgoal.SetFocus

    End Sub

    Private Sub cmdShowhelp_Click()
    ' Purpose: When the Display Second Form button is clicked,
    ' the second form becomes visible.
    frmSecond.Show
    End Sub
    ' Purpose: When the user closes this form, the second form is also
    ' unloaded from memory, thus ending the application
    Private Sub Form_Unload(Cancel As Integer)
    Unload frmSecond
    End Sub

    Private Sub cmdSummary_Click() 'This lets you view the investment that has just been made
    ' Purpose: When the Display Second Form button is clicked,
    ' the second form becomes visible.
    frmSummary.Show
    End Sub

    ' Purpose: When the Display Second Form button is clicked,
    ' the second form becomes visible.
    Private Sub cmdShowSummary_Click()
    frmSummary.Show
    End Sub

    ' Purpose: When the user closes this form, the second form is also
    ' unloaded from memory, thus ending the application
    Unload frmSummary
    End Sub
    Private Sub Form_Load() ' This hides the folowing buttons when you play the program
    cmdportfolio.Visible = False 'This won't be shown in program
    cmdClear.Visible = False 'This won't be shown in program
    cmdAddtoclub.Visible = False 'This won't be shown in program
    cmdNewinvestor.Visible = False 'This won't be shown in program
    lblNoinvestors.Visible = False 'This won't be shown in program
    txtNoinvestors.Visible = False 'This won't be shown in program
    cmdSummary.Visible = False 'This won't be shown in program
    lblInitial.Visible = False 'This won't be shown in program
    txtInitial.Visible = False 'This won't be shown in program
    End Sub

    please have a look, i will be very grateful

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Welcome to the DevX.

    That is a whole lot of code to go through....how about if you just indicate what, if any, problems you are having and we will see what we can do about fixing them.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  3. #3
    Join Date
    Jan 2008
    Posts
    13

    pseudocode

    not sure if the pseudocode for the calculate, add to club, add to portfolio, new investor is correct.

  4. #4
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Well, in theory it looks correct.

    Sometimes theory translates well into code, other times it doesn't. Try it out and see what happens.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

Similar Threads

  1. Memory problem with Borland C3.1
    By AZ1699 in forum C++
    Replies: 11
    Last Post: 11-16-2007, 12:23 PM
  2. App Problem with MS Office ...
    By Shannon in forum VB Classic
    Replies: 7
    Last Post: 06-24-2007, 08:47 PM
  3. Replies: 0
    Last Post: 12-13-2001, 12:06 PM
  4. Arabic problem view
    By Ayman in forum VB Classic
    Replies: 0
    Last Post: 04-03-2000, 01:08 AM
  5. Problem with CryptoAPI and JCE
    By Jason Bock in forum VB Classic
    Replies: 0
    Last Post: 03-21-2000, 06:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center