<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Help on Pascal Program: Balance' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Help on Pascal Program: Balance' posted on the 'Pascal' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Sat, 25 May 2013 12:35:11 -0700</pubDate>
    <lastBuildDate>Sat, 25 May 2013 12:35:11 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Help on Pascal Program: Balance</title>
      <link>http://www.programmersheaven.com/mb/pasprog/415247/415247/help-on-pascal-program-balance/</link>
      <description>Hi, I'm doing a program on Balance, and it's suppose to look something like this. &lt;br /&gt;
&lt;br /&gt;
                            Year&lt;br /&gt;
Balance  Rate(%)  1  2  3  4  5  6  7  8  9  10&lt;br /&gt;
100      10      110 121 133 146 161 177 ... ... &lt;br /&gt;
200      10      ... ... ... ...&lt;br /&gt;
300      10      ... ... .. &lt;br /&gt;
400      10      .... ... ..&lt;br /&gt;
500      10      ... ... ...&lt;br /&gt;
&lt;br /&gt;
I did the program but it keeps coming out wrong. Can someone please help me fix my program or tell me what am i missing?&lt;br /&gt;
&lt;br /&gt;
PROGRAM BALANCE(INPUT,OUTPUT, DATA6, OUT6);&lt;br /&gt;
&lt;br /&gt;
VAR DATA6, OUT6: TEXT;&lt;br /&gt;
	BALANCE, RATE: INTEGER;&lt;br /&gt;
	VCOUNT, LCOUNT: INTEGER;&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
(*************************************************
*)&lt;br /&gt;
PROCEDURE ProduceLine(VAR VCOUNT, BALANCE, RATE: INTEGER);&lt;br /&gt;
&lt;br /&gt;
BEGIN&lt;br /&gt;
WRITE(BALANCE:6);&lt;br /&gt;
WRITE(RATE:6);&lt;br /&gt;
VCOUNT:= 0;&lt;br /&gt;
WHILE VCOUNT &amp;lt;= 10 DO&lt;br /&gt;
	BEGIN&lt;br /&gt;
		BALANCE:= BALANCE + BALANCE * RATE;&lt;br /&gt;
		WRITE(BALANCE);&lt;br /&gt;
		VCOUNT:= VCOUNT + 1&lt;br /&gt;
		&lt;br /&gt;
		END;&lt;br /&gt;
END;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(*************************************************
)&lt;br /&gt;
PROCEDURE ProduceTable(VAR LCOUNT, VCOUNT: INTEGER; &lt;br /&gt;
						   BALANCE, RATE: INTEGER);&lt;br /&gt;
BEGIN						   &lt;br /&gt;
WRITELN('YEAR');&lt;br /&gt;
WRITELN('BALANCE  RATE(%)');&lt;br /&gt;
LCOUNT:= 0;&lt;br /&gt;
WHILE LCOUNT &amp;lt;= 5 DO&lt;br /&gt;
	BEGIN&lt;br /&gt;
	ProduceLine(VCOUNT, BALANCE, RATE);	&lt;br /&gt;
	BALANCE:= BALANCE + 100;&lt;br /&gt;
	LCOUNT:= LCOUNT + 1;&lt;br /&gt;
	WRITELN&lt;br /&gt;
	END;&lt;br /&gt;
END;	&lt;br /&gt;
(************************************************)&lt;br /&gt;
&lt;br /&gt;
BEGIN&lt;br /&gt;
RESET(DATA6);&lt;br /&gt;
REWRITE(OUT6);&lt;br /&gt;
WRITE('ENTER BALANCE AND RATE:');&lt;br /&gt;
READ(BALANCE, RATE);&lt;br /&gt;
WHILE NOT EOF DO&lt;br /&gt;
	BEGIN&lt;br /&gt;
	ProduceTable(LCOUNT, VCOUNT, BALANCE, RATE);&lt;br /&gt;
	WRITELN;&lt;br /&gt;
	IF EOLN &lt;br /&gt;
		THEN READLN&lt;br /&gt;
	END;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
END.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/415247/415247/help-on-pascal-program-balance/</guid>
      <pubDate>Wed, 07 Apr 2010 13:14:19 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Help on Pascal Program: Balance</title>
      <link>http://www.programmersheaven.com/mb/pasprog/415247/415346/re-help-on-pascal-program-balance/#415346</link>
      <description>Your program seems to be a savings accumulation program.  Here's my solution.&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
program balanceprog ; &lt;span style="color: Red;"&gt;{ my compiler, TP7.0, does not allow
                      the use of the word &lt;strong&gt;balance&lt;/strong&gt;
                      as both a program name and as a variable
                      so I've changed the name of the program. }&lt;/span&gt;

        procedure producetable (balance, rate : real) ;
            &lt;span style="color: Red;"&gt;{
                &lt;strong&gt;balance&lt;/strong&gt; and &lt;strong&gt;rate&lt;/strong&gt; are the only variables
                that need to be passed to the procedure.  The only
                other variable, &lt;strong&gt;lcount&lt;/strong&gt;, is only used locally
                and is declared as such.  In any case TP requires that
                index counters be declared locally.
            }&lt;/span&gt;

            procedure produceline (balance, rate : real) ;
                &lt;span style="color: Red;"&gt;{
                    &lt;strong&gt;produceline&lt;/strong&gt; is invoked only  by
                    &lt;strong&gt;producetable&lt;/strong&gt; so it is appropriate to nest
                    the latter within the former.
                }&lt;/span&gt;
    
            var
                vcount : integer ; &lt;span style="color: Red;"&gt;{ must be local }&lt;/span&gt;
    
            begin
                write(balance:7:0) ;
                write(rate:8:0) ;
    
                for vcount := 1 to 10 do begin
                    balance:= balance + (balance * rate / 100.0) ;
                    write(balance:6:0)
                end
            end ;
        
        var
            lcount : integer ;

        begin
            writeln ('year') ;
            write   ('balance rate(%)') ;
            for lcount := 1 to 10 do
                write (lcount:6) ;
            writeln ;

            for lcount := 1 to 5 do begin
                produceline (balance, rate) ;
                balance := balance + 100.0 ;
                writeln
            end
        end ;

var
    balance, rate   :   real ;  &lt;span style="color: Red;"&gt;{ real fits these variables
                                       better than integer }&lt;/span&gt;

begin
    writeln ;
    write ('enter balance and rate:') ;
    read (balance, rate) ;

    producetable (balance, rate) ;
    writeln
end.
&lt;/pre&gt;&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/415247/415346/re-help-on-pascal-program-balance/#415346</guid>
      <pubDate>Sun, 11 Apr 2010 19:07:32 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Help on Pascal Program: Balance</title>
      <link>http://www.programmersheaven.com/mb/pasprog/415247/415347/re-help-on-pascal-program-balance/#415347</link>
      <description>Your program seems to be a savings accumulation program.  Here's my solution.&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
program balanceprog ; &lt;span style="color: Red;"&gt;{ my compiler, TP7.0, does not allow
                      the use of the word &lt;strong&gt;balance&lt;/strong&gt;
                      as both a program name and as a variable
                      so I've changed the name of the program. }&lt;/span&gt;

        procedure producetable (balance, rate : real) ;
            &lt;span style="color: Red;"&gt;{
                &lt;strong&gt;balance&lt;/strong&gt; and &lt;strong&gt;rate&lt;/strong&gt; are the only variables
                that need to be passed to the procedure.  The only
                other variable, &lt;strong&gt;lcount&lt;/strong&gt;, is only used locally
                and is declared as such.  In any case TP requires that
                index counters be declared locally.
            }&lt;/span&gt;

            procedure produceline (balance, rate : real) ;
                &lt;span style="color: Red;"&gt;{
                    &lt;strong&gt;produceline&lt;/strong&gt; is invoked only  by
                    &lt;strong&gt;producetable&lt;/strong&gt; so it is appropriate to nest
                    the latter within the former.
                }&lt;/span&gt;
    
            var
                vcount : integer ; &lt;span style="color: Red;"&gt;{ must be local }&lt;/span&gt;
    
            begin
                write(balance:7:0) ;
                write(rate:8:0) ;
    
                for vcount := 1 to 10 do begin
                    balance:= balance + (balance * rate / 100.0) ;
                    write(balance:6:0)
                end
            end ;
        
        var
            lcount : integer ;

        begin
            writeln ('year') ;
            write   ('balance rate(%)') ;
            for lcount := 1 to 10 do
                write (lcount:6) ;
            writeln ;

            for lcount := 1 to 5 do begin
                produceline (balance, rate) ;
                balance := balance + 100.0 ;
                writeln
            end
        end ;

var
    balance, rate   :   real ;  &lt;span style="color: Red;"&gt;{ real fits these variables
                                       better than integer }&lt;/span&gt;

begin
    writeln ;
    write ('enter balance and rate:') ;
    read (balance, rate) ;

    producetable (balance, rate) ;
    writeln
end.
&lt;/pre&gt;&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/415247/415347/re-help-on-pascal-program-balance/#415347</guid>
      <pubDate>Sun, 11 Apr 2010 19:11:41 -0700</pubDate>
      <category>Pascal</category>
    </item>
  </channel>
</rss>