123 Eng

Engineering the engineers™


Latest Jobs   Forum Map

 


Home
Source Codes
Engineering Colleges

Training  Reports
Seminar Reports
Placement Papers

Forums

   Computer Science / IT
   Electronics
   Electrical
   Mechanical
   Chemical
   Civil

   CAT / MBA

   GMAT / Foreign MBA
Latest Jobs

Engineering Jobs / Technical Jobs
Management Jobs

Sitemap
Terms of use

Displaying  Source Code(s)  
 

 
Program to compute compound interest.

--------------------------------------------------------------------------------



IDENTIFICATION DIVISION.
PROGRAM-ID. Q6.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. IBM PC.
OBJECT-COMPUTER. IBM PC.
INPUT-OUTPUT SECTION.
SELECT IN-FILE ASSIGN TO "Q6IN.DAT" ORGANIZATION IS
LINE SEQUENTIAL.
SELECT OUT-FILE ASSIGN TO "Q6OUT.TXT".

DATA DIVISION.
FILE SECTION.
FD IN-FILE.
01 IN-REC.
02 IN-PRINCIPAL PIC 9(5)V99.
02 IN-ROI PIC 99.
02 IN-TIME PIC 99.
FD OUT-FILE.
01 OUT-REC PIC X(80).


WORKING-STORAGE SECTION.
77 COMPOUND-INTEREST PIC 9(4)V99.
77 EOF PIC X VALUE "N".
77 HEADING1 PIC X(80) VALUE ALL "-".
01 OUT-FORMAT.
02 OUT-PRINCIPAL PIC 9(5)V99.
02 F PIC X(5) VALUE SPACES.
02 OUT-ROI PIC 99.
02 F PIC X(5) VALUE SPACES.
02 OUT-TIME PIC 99.
02 F PIC X(10) VALUE SPACES.
02 OUT-COMPOUND-INTEREST PIC 9999.99.

PROCEDURE DIVISION.
MAIN-PARA.
OPEN INPUT IN-FILE OUTPUT OUT-FILE.
MOVE HEADING1 TO OUT-REC.
WRITE OUT-REC BEFORE ADVANCING 1 LINE.
MOVE " COMPOUND INTEREST CALCULATION"
TO OUT-REC.
WRITE OUT-REC BEFORE ADVANCING 1 LINE .
MOVE HEADING1 TO OUT-REC.
WRITE OUT-REC BEFORE ADVANCING 1 LINE.
MOVE "AMT (RS.) RATE TIME (YR.) COMP. INTEREST (RS.) " to OUT-REC.
WRITE OUT-REC BEFORE ADVANCING 1 LINE.

READ IN-FILE AT END MOVE "Y" TO EOF.
PERFORM CALC-PARA UNTIL EOF = "Y".
DISPLAY "THE DETAILS HAVE BEEN WRITTEN TO FILE Q6OUT.DAT".
CLOSE IN-FILE , OUT-FILE.
STOP RUN.

CALC-PARA.
COMPUTE COMPOUND-INTEREST
= IN-PRINCIPAL * ( 1 + IN-ROI / 100 ) ** IN-TIME
MOVE IN-PRINCIPAL TO OUT-PRINCIPAL.
MOVE IN-ROI TO OUT-ROI.
MOVE IN-TIME TO OUT-TIME.
MOVE COMPOUND-INTEREST TO OUT-COMPOUND-INTEREST.
MOVE OUT-FORMAT TO OUT-REC.
WRITE OUT-REC BEFORE ADVANCING 1 LINE.

READ IN-FILE AT END MOVE "Y" TO EOF.
--------------------------------------------------------------------------------
 

 

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved © copyright 123ENG