Results 1 to 5 of 5

Thread: Small Request With College Psuedocode Assignment

  1. #1
    Join Date
    Mar 2006
    Location
    Northern Kentucky
    Posts
    34
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Small Request With College Psuedocode Assignment

    Heya Guys and or Gals!
    I've been working with Psuedocode for college and we're playing around with loops. I have this code written up but it just looks outright terrible.
    Would anyone be able to rewrite the module so it's a bit cleaner?
    Code:
    finishLine()
        investment = 10,0000
             tBills = 0
             tBillRate = .03 
            bonds = 0
           corpBondRate = .06
            stocks = 0
            stocksRate = .09
        for yearIncrement = 1 to 40 
            tBills = tBills + investment *1.03
            yearIncrease = investment * tBillrate
    if yearIncrement = 1 then 
         print  investment, investmentReturn,  tBillRate 
         else 
         print tBills, investmentReturn,  tBillRate
    endif
           
    
    
          bonds = bonds + investment  *1.06
    if yearIncrement = 1 then 
         print  investment, investmentReturn, corpBondRate
         else 
         print bonds, investmentReturn, corpBondRate
    endif
            stocks = stocks + investment * 1.09
    if yearIncrement= 1 then 
         print  investment, investmentReturn, stocksRate
         else 
         print stocks, investmentReturn, stocksRate
    endif
         yearIncrement = yearIncrement + 1
         if yearIncrement= 10 then
                 numberYears = numberYears + 10
              if yearIncrement = 20 then
                   numberYears = numberYears + 10
                if yearIncrement = 30 then
                         numberyears = numberYears + 10
                  endif  
          
    
               endif
           endif
    perform FinishLine()
    Return
    If not one has replied by 2am Eastern time tonight go ahead and delete this thread and I'll turn in as is. Thanks people

  2. #2
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Which p language is this? vb?
    ~Hermen

  3. #3
    Join Date
    Feb 2007
    Location
    Toronto, Ontario, Canada
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hopefully I got this right
    Code:
    finishLine()
        investment = 100000
        tBills = 0
        tBillRate = .03
        bonds = 0
        corpBondRate = .06
        stocks = 0
        stocksRate = .09
        for yearIncrement = 1 to 40
            tBills = tBills + investment *1.03
            yearIncrease = investment * tBillrate
            if yearIncrement = 1 then
               print  investment, investmentReturn,  tBillRate
               bonds = bonds + investment  *1.06
               print  investment, investmentReturn, corpBondRate
               stocks = stocks + investment * 1.09
               print  investment, investmentReturn, stocksRate
            else
                print tBills, investmentReturn,  tBillRate
                print bonds, investmentReturn, corpBondRate
                print stocks, investmentReturn, stocksRate
            endif
            yearIncrement = yearIncrement + 1 // do you mean to call this when already in a for loop
           case yearIncrement of
                10, 20, 30 : numberYears = numberYears + 10;
           endcase
    
           if yearIncrement= 10 then
           
        endfor
    
    
    perform FinishLine()
    Return

  4. #4
    Join Date
    Mar 2006
    Location
    Northern Kentucky
    Posts
    34
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Hermpie View Post
    Which p language is this? vb?
    Just psuedocode

  5. #5
    Join Date
    Mar 2006
    Location
    Northern Kentucky
    Posts
    34
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Agent your a genius! Looks great to me. The 2nd call at the bottom was a mistake been up all night revising it xD

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. 2008-2009 college bowl games
    By poopy2177 in forum NOTA
    Replies: 6
    Last Post: 12-11-2008, 12:03 AM
  2. College Homework Lesson
    By Moloch in forum OSR Help
    Replies: 2
    Last Post: 11-05-2008, 02:04 PM
  3. i may go play college football :D
    By wired16 in forum News and General
    Replies: 6
    Last Post: 05-17-2007, 12:00 AM
  4. Virginia College Massacre
    By Smartzkid in forum News and General
    Replies: 28
    Last Post: 04-27-2007, 05:37 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
  •