CariDotMy

 Forgot password?
 Register

ADVERTISEMENT

View: 2623|Reply: 1

COBOL Programming

[Copy link]
Post time 18-9-2007 11:59 AM | Show all posts |Read mode
Are there any COBOL programmer in here? If someone who knows cobol please help me with my program. I code it, but i don't know why it does not calculate the finance charge and the month-end-balance.

Here is the topic:
Write a program to compute and print the month-end-balance. Assume an annual finance rate of 18% on the unpaid balance. Run the program once for each customer

INPUT(Keyboard)
for each customer, prompt for and enter the following data
last name previous balance Payments Charges
Allen 5000.00 0.00 200.00
Davis 2150.00 150.00 0.00

Output(Screen)
For each customer, print the following billing information

Author Charge Account mm/dd/yyyy

Customer: X------X
Finance charge: $ 99.99
month-end-balance: $ 9999.99

Processing Requirements:
* compute the new balance:
previous balance - payments + charges
* compute the finace charge:
new balance * (annual rate / 12)
* compute the month-end-balance:
new balance + finance charge
Reply

Use magic Report


ADVERTISEMENT


 Author| Post time 18-9-2007 12:05 PM | Show all posts
Here my code...but error larrr

IDENTIFICATION DIVISION.
PROGRAM-ID. Assignment.
AUTHOR. Farhan.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 LASTNAME PIC X(6).
01 PREVIOUSBALANCE PIC 9(4)V99.
01 PAYMENTS PIC 9(3)V99.
01 CHARGES PIC 9(3)V99.
01 ANNUALRATE PIC 9V99 VALUE 0.18.
01 NEWBALANCE PIC 999V99.
01 FINANCECHARGE PIC 9V99.
01 MONTHENDBALANCE PIC 9999V99.
01 CUSTOMERNAME PIC X(8).
01 O-FINANCECHARGE PIC 99.
01 O-MONTHENDBALANCE PIC 999.99.

PROCEDURE DIVISION.
DISPLAY 'Enter your last name: ' WITH NO ADVANCING
ACCEPT LASTNAME
DISPLAY 'Enter your previous balance: $ ' WITH NO ADVANCING
ACCEPT PREVIOUSBALANCE
DISPLAY 'Enter your payments: $ ' WITH NO ADVANCING
ACCEPT PAYMENTS
DISPLAY 'Enter your finance charge: $ ' WITH NO ADVANCING
ACCEPT CHARGES
COMPUTE NEWBALANCE = PREVIOUSBALANCE - PAYMENTS + CHARGES

COMPUTE FINANCECHARGE = NEWBALANCE *( annualrate / 12)
COMPUTE MONTHENDBALANCE = NEWBALANCE + FINANCECHARGE
DISPLAY ' Nhu Ngoc CHARGE ACCOUNT 02/11/2004 '
DISPLAY ' CUSTOMER: ' LASTNAME.
DISPLAY ' FINANCE CHARGE: $ ' O-FINANCECHARGE.
DISPLAY ' MONTH END BALANCE: $ ' O-MONTHENDBALANCE.
STOP RUN

the problem is the formula is not give the correct result and need to loop this funtion...i'm juz the beginner in this COBOL programming...some one please help me ... no matter in create new code or modifiy my code above ... stuck already... thanks
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

 

ADVERTISEMENT



 

ADVERTISEMENT


 


ADVERTISEMENT
Follow Us

ADVERTISEMENT


Mobile|Archiver|Mobile*default|About Us|CariDotMy

5-1-2025 09:15 AM GMT+8 , Processed in 0.039009 second(s), 15 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

Quick Reply To Top Return to the list