1 Replies - 484 Views - Last Post: 06 October 2010 - 07:54 PM Rate Topic: -----

#1 tmcandrew  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 03-October 10

Right Justify decimals

Posted 03 October 2010 - 05:41 AM

I am having trouble right justifying my numbers based on decimal point. Can anyone tell me what I am doing wrong or missing. Here is the code I have so far...by the way this is in Qbasic.
CLS

GOSUB init
GOSUB LoopProcess
GOSUB eoj
END

'*******************
'  Initialization
'*******************

init:
numrec = 0
grosspay = 0

OPEN "g:\cis115\w06\ex61pay.dat" FOR INPUT AS #1


PRINT "                         Payroll File List                        "
PRINT
PRINT "Employee          Marital Rate of  <-------Year-To-Date-------->  "
PRINT "No. Name     Dep. Status  Pay      Gross Pay With. Tax Soc. Sec."
PRINT "--- -------- ---- ------- -------  --------- --------- ---------"
li$ = "\  \\       \ ##  \     \   ##.##  ##,###.## ##,###.##  #,###.##"

RETURN

'*******************
'  Loop Process
'*******************

LoopProcess:


DO WHILE NOT EOF(1)
    INPUT #1, empnum$, empname$, dep, marstat$, rate, gross, with, soc
    numrec = numrec + 1
    grosspay = grosspay + gross
    withholding = withholding + with
    social = social + soc
    PRINT USING li$; empnum$; empname$; dep; marstat$; rate; gross; with; soc


LOOP

RETURN


'*******************
' End of Job
'*******************

eoj:
PRINT
PRINT "Total Number of Records ========>      "; numrec
PRINT USING "Total YTD Gross Pay ============> ###,###.##"; grosspay
PRINT USING "Total YTD Withholding Tax ======>  ##,###.##"; withholding
PRINT USING "Total YTD Social Security ======>  ##,###.##"; social
PRINT "Job Complete"


CLOSE #1

RETURN



Edited by macosxnerd101: Please, :code:.

Is This A Good Question/Topic? 0
  • +

Replies To: Right Justify decimals

#2 calvinthedestroyer  Icon User is offline

  • D.I.C Lover

Reputation: 167
  • View blog
  • Posts: 1,911
  • Joined: 13-October 07

Re: Right Justify decimals

Posted 06 October 2010 - 07:54 PM

Can you show me what ex61pay.dat looks like?
Maybe something is off in your input file?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1