O.k. this is my first scripting class and I need someone's opinion on this code. I need to write a code for a modularized program that will:

1.) read each record from the inventory database

2.) print a price tag for each item in inventory

3.) count and print the total number of tags printed

4.)sum and print the total retail value of the inventory in the store

Here's the code I came up with. Please tell me if it is correct or not.

start
   perform housekeeping ('This will declare variables perform housekeeping )	(with read)
     while not eof
     perform mainLoop (‘This will read each record from the database)
perform calculateTotalretailvalue ( )
endwhile 
perform finishup ( )
stop

housekeeping ( )
       declare variables
           
              invRecord
                         char	invDescription
                         num	invItemnumber
                         num	invQuantity
                         num	invRetailprice
                         num	invTotalretailvalue
                         num	invTotaltags

             char mainHeading = "INVENTORY REPORT"	
             char columnHead1 =
               "ITEM	RETAIL PRICE	QUANTITY		DESCRIPTION"

             char columnHead2 =
               "TOTAL RETAIL VALUE		TOTAL TAGS	ITEM NUMBER"
             num totalRetailvalue
open files
       INVENTORY , Printer
print mainHeading
print columnHead1
print columnHead2
read invRecord
return

mainloop ( )
Read the first record
While not eof
       Print fldItemnumber , fldDescription , fldQuantityonhand , fldRetailPrice
       ItemCount = ItemCount +1
       Totalretailvalue = (fldQuantity * fldRetailprice )
endwhile
Read next record
Loop

Print “Retail price : “ & ItemCount
Print “Value of Inventory = “ & Totalretailvalue
return

calculateTotalretailvalue ( )
     Totalretailvalue = (fldQuantity * fldRetailprice )
return

printTotalretailvalue ( )
     print Totalretailvalue
return
finishup ( )
   close files
       INVENTORY , Printer
return
This article has been dead for over six months. Start a new discussion instead.