Program for electricity bill, COBOL Programming

Assignment Help:

PROGRAM FOR ELECTRICITY BILL:

An electricity company supplies electricity to 4 types of customers coded 1, 2, 3 & 4.The rate schedule for customers is shown in one table as 

           Customer code            1        2         2        3        3       4

           Consumption             All    Below  1000&  Below  5000&   All  

                                                     1000     above   5000     above

           Rate/unit                   0.50    0.40     0.50     0.30      0.50       0.30

           The customer record is:

              col:1-5   customer no.

              col:6-60  name & address.

              col:61-67 consumption in units.

              col:68    customer code.

 

           Read  a customer record and print a bill using GOTO  DEPENDING 

        ON statement.

 

  identification division.

  program- id.

  environment division.

  input-output section.

  file-control.

    select efile assign to disk

    organization is line sequential.

  data division.

  file section.

  fd  efile

label records are standard

value of file- id is "e.dat".

  01  erec.

    02  ccode  pic 9.

    02  units       pic 9(7).

 

  working-storage section.

  01   ans pic x value space.

  01   head-1 pic x(80) value all '-'.

  01   amt  pic 9(5)v9(2) value 0.

 

  01   head-2.

    02  f pic x(11) value spaces.

    02  f pic x(6) value "CSCODE".

    02  f pic x(11) value spaces.

    02  f pic x(5) value "Units".

    02  f pic x(11) value spaces.

    02  f pic x(10) value "Amount".

    02  f pic x(11) value spaces.

 

  01 head-3.

    02  f pic x(5) value spaces.

    02  e-ccode  pic z.

    02  f pic x(5) value spaces.

    02  e-units pic z(7).

    02  f pic x(10) value spaces.

    02  e-amt  pic z(5).z(2). 

  screen section.

  01  b-screen.

    02 blank screen.

 

  procedure division.

  p-1.

    open extend efile.

    perform g-w-para until ans = 'n' or 'N'.

    close efile.

 

    open input efile.

    display head-1.

    display head-2.

    display head-1.

  read-para.

    read efile at end go to close-para.

    go to c1  c2  c3 c4 depending on ccode.

  c1.

    compute amt = units * 0.50

    go to m-para.  

  c2.

    if ( units < 1000)

    compute amt = units * 0.40

    go to m-para.  

  if (units not < 1000 ) 

        compute amt = (units - 999) * 0.5 + 999 * 0.40

    go to m-para.    

c3.

  if (units < 5000)

  compute amt =  units * 0.30

    go to m-para

  else  

          compute amt = (units - 4999) * 0.5 + 4999 * 0.30

    go to m-para.  

c4.  

  compute amt = units * 0.30.

     m-para.

  move amt to e-amt.

  move ccode to e-ccode.

  move units to e-units.

  display head-3.

  go to read-para.

close-para.

  display head-1.

  close efile.

  stop run.

  g-w-para.

    display b-screen.

    display(3 5) "Cus Code: ".

    accept ccode.

    display (5 5) "Units : ".

    accept units.

    write erec.

    display(10 5) "Continue [y/n] : ".

    accept ans.   

 


Related Discussions:- Program for electricity bill

Example of write statement, Example of Write statement: Illustration:...

Example of Write statement: Illustration: (i) WRITE TRANS-RECORD AFTER ADVANCING 3 LINES. This WRITE statement specified that the TRANS-RECORD is a record name of a fi

Example of constructing an arithmetic expression, Example of constructing a...

Example of constructing an arithmetic expression: An arithmetic expression may be proceeded by a + or - sign. These operations are known as unary + or unary - operators. Il

Numeric literals - cobol program, Numeric -   Literals : The numeri...

Numeric -   Literals : The numeric literal can be created with the help of digits only. It can have a sign (+ or -) and can also have a decimal point. If no sign is specifi

Program for master file maintenance , PROGRAM FOR MASTER FILE MAINTENANCE: ...

PROGRAM FOR MASTER FILE MAINTENANCE: We have to write a program to keep the stu-file for which a record has just 2 fields,viz., rno(Roll Number) and name(Student Name). Give t

Simple merge verb, SIMPLE MERGE VERB: Like sorting, the merging of fil...

SIMPLE MERGE VERB: Like sorting, the merging of files is often required in different commercial application. It is likely to merge two or more files with the help of one MERGE

Compound condition, COMPOUND CONDITION: The two simple conditions can ...

COMPOUND CONDITION: The two simple conditions can be connected by the logical operators AND or OR to form a compound condition (also termed as combined condition). When two co

File-control paragraph for the indexed files, FILE-CONTROL paragraph for th...

FILE-CONTROL paragraph for the indexed files: The common format for the SELECT clause for a file is as shown below: SELECT  file-name  ASSIGN   TO  implementor -name

Figurative constants - cobol program, Figurative Constants: The Figura...

Figurative Constants: The Figurative constants have several fixed names and the compiler recognizes these names and it sets up the equivalent values in the object program.

File status clause, FILE STATUS clause: This clause has been involved ...

FILE STATUS clause: This clause has been involved in the above syntax for completeness. The ORGANIZATION, REVERSE, ACCESS and STATUS clause can be specified in any order.

Cobol words, COBOL Words: The COBOL word can be formed by using the ch...

COBOL Words: The COBOL word can be formed by using the characters as shown below: 0-9 A-Z (a-z) - (hyphen) The rules below should be hold in forming the COBOL words.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd