UPSB v4

Off-topic / Pascal Programming

  1. Mike
    Date: Mon, Feb 28 2011 02:22:40

    I'm taking a Programming Fundamentals class, and we use Pascal to write our programs. If anybody knows Pascal, help would be greatly appreciated. For this program, I'm supposed to get data from a file that our Professor gives us and when we get it, we're supposed to reset the data originally on there, then rewrite it with new data inputed by the user. I'm not exactly sure how to write that part of the code, all I have is this:

    Spoiler[CODE]PROGRAM INTEREST (INPUT, OUTPUT); (* *************** -CHAPTER 7 ASSIGNMENT -MICHAEL HERNANDEZ -INSTRUCTOR: COACH -SECTION: D6 -FEBRUARY 23, 2011 -PROBLEM TO CREATE INTEREST CHART TO FIND BALANCE OF AN ACCOUNT IN TEN YEARS *************** INPUT: OUTPUT: LEVEL 0 OPEN FILES GET BALANCE RATE PRODUCE A TABLE SKIPE A LINE LEVEL 1 OPEN FILES RESET DATA6 REWRITE OUT6 PRODUCE A TABLE SET LINE COUNTER TO 0 PRODUCE HEADINGS WRITE LINE COUNTER < 5 PRODUCE A LINE ADD 1 TO COUNTER ADD 100 TO BALANCE LEVEL 2 PRODUCE HEADINGS WRITEALINE "YEAR" WRITEALINE "BALANCE, RATE, 123" PRODUCE A LINE WRITE BALANCE AND RATE SET VALUE COUNTER TO 0 WHILE MORE VALUES BALANCE = BALANCE+BALANCE*(RATE/100) WRITE BALANCE ADD 1 TO VALUE COUNTER WRITE *************** *) BEGIN (*LEVEL 0 OPEN FILES GET BALANCE RATE PRODUCE A TABLE SKIPE A LINE LEVEL 1 OPEN FILES*) RESET(OUT6) REWRITE(OUT6) PROCEDURE PRODUCETABLE(COUNTER,BALANCE:INTEGER;)(*PRODUCE A TABLE*) COUNTER:=0; (*PRODUCE HEADINGS*) WHILE COUNTER<5 DO BEGIN PRODUCELINE; COUNTER:=COUNTER+1; BALANCE:=BALANCE+100 END; (*LEVEL 2 PRODUCE HEADINGS*) WRITELN('ENTER YEAR:'); WRITELN('ENTER BALANCE AND RATE NUMBER:'); PROCEDURE PRODUCELINE(BAL,RATE:REAL;VARDAT6:TEXT); VAR VCOUNT:INTEGER; BEGIN WRITE(OUT6,ROUND(BAL):6,ROUND(RATE):6); WHILE VCOUNT<10 DO BEGIN BAL:=BAL+BAL*(RATE/100); WRITE(OUT6,ROUND(BAL):6); VCOUNT:=VCOUNT+1 END WRITELN(OUT6) END; WRITELN(OUT6.DAT) END.[/CODE]
    Anything in parentheses (*like this*) are comments, and not part of code. Just in case you were wondering.

  2. nateiskewl
    Date: Mon, Feb 28 2011 02:36:21

    Are you traveling back in time to take this class?

  3. Sc00t
    Date: Mon, Feb 28 2011 02:40:27

    [color=green]>pascal programming[/color] :whut:

  4. Mike
    Date: Mon, Feb 28 2011 07:11:26

    nateiskewl wrote: Are you traveling back in time to take this class?
    It's just to learn basic fundamentals of programming.

  5. Zombo
    Date: Tue, Mar 1 2011 04:22:05

    jesus... pascal... too ancient for me

  6. Mike
    Date: Tue, Mar 1 2011 04:40:45

    Zombo wrote: jesus... pascal... too ancient for me
    I know ha. I guess I'll try to figure this out on my own.