Can someone please help me. I have written two programs. The first programs will run up to the rows of info then it will put in end for the name and the end total and not each number then a total. I've been working on this for a week. Please help
'***********Program Mainline***********
CLS
GOSUB InitializeImages
GOSUB ProcessDetail
END
'**********Initialize Print Images******
InitializeImages:
LET T1$ = " Recording Studio Rent Charges"
LET H1$ = " Group Name Mintues Used Charges"
LET D1$ = " \ \ #### $#,###.##"
LET TL$ = " "
RETURN
'*********Process Detil*******************
ProcessDetail:
CLS
PRINT TAB(25); "Recording Studio Rent Charges"
GOSUB InputData
DO UNTIL UCASE$(Name$) = "END"
GOSUB inputMinutes
GOSUB CalculateCharge
PRINT
GOSUB InputData
LOOP
GOSUB PrintTitleAndHeader
GOSUB Summarize
GOSUB PrintOutput
RETURN
'*********Input Data**********************
CLS
InputData:
PRINT
INPUT "Name of group (END to Quit)"; Name$
RETURN
'********Input Minutes***************
inputMinutes:
INPUT "Enter Minutes used"; Minutes
RETURN
'*********CalculateCharge*************
CalculateCharge:
LET hourrate = 200
LET Rate = (hourrate / 60) * Minutes
LET Charge = INT(Rate * 100 + .5) / 100
PRINT
LET TotalMinutes = TotalMinutes + Minutes
LET TotalCharge = TotalCharge + Charge
RETURN
'***********Summarize****************
Summarize:
PRINT USING D1$; Name$; Minutes; TotalCharge
RETURN
'*********PrintTitleAndHeader**********
PrintTitleAndHeader:
PRINT
PRINT TAB(20); T1$
PRINT
PRINT H1$
RETURN
'*********Print Output********************
PrintOutput:
PRINT
PRINT "Total Charge for All Groups"; TotalCharge;
RETURN
'****************EndofProgram**************
help with program
Moderators:Administrator, Global Moderator
Code: Select all
'***********Program Mainline***********
CLS
GOSUB InitializeImages
GOSUB ProcessDetail
END
'**********Initialize Print Images******
InitializeImages:
T1$ = " Recording Studio Rent Charges"
H1$ = " Group Name Mintues Used Charges"
D1$ = " \ \ #### $#,###.##"
TL$ = " "
RETURN
'*********Process Detil*******************
ProcessDetail:
CLS
PRINT TAB(25); "Recording Studio Rent Charges"
GOSUB InputData
DO UNTIL UCASE$(Name$(k&)) = "END"
GOSUB inputMinutes
GOSUB CalculateCharge
PRINT
GOSUB InputData
LOOP
k& = k& - 1
GOSUB PrintTitleAndHeader
GOSUB summarize
GOSUB PrintOutput
RETURN
'*********Input Data**********************
CLS
InputData:
PRINT
k& = k& + 1
INPUT "Name of group (END to Quit)"; Name$(k&)
RETURN
'********Input Minutes***************
inputMinutes:
INPUT "Enter Minutes used"; Minutes(k&)
RETURN
'*********CalculateCharge*************
CalculateCharge:
hourrate = 200
Rate(k&) = (hourrate / 60) * Minutes(k&)
Charge(k&) = INT(Rate(k&) * 100 + .5) / 100
PRINT
TotalMinutes = TotalMinutes + Minutes
TotalCharge = TotalCharge + Charge(k&)
RETURN
'***********Summarize****************
summarize:
FOR x& = 1 TO k&
PRINT USING D1$; Name$(x&); Minutes(x&); Charge(x&)
'TotalCharge
NEXT
RETURN
'*********PrintTitleAndHeader**********
PrintTitleAndHeader:
PRINT
PRINT TAB(20); T1$
PRINT
PRINT H1$
RETURN
'*********Print Output********************
PrintOutput:
PRINT
PRINT "Total Charge for All Groups"; TotalCharge;
RETURN
'****************EndofProgram**************
Use of CLS at beginning of program
Actually, it IS accessed, as soon as the program starts, as the first command.Buff1 wrote:one other comment. the CLS just before InputData: will NEVER be accessed. Therefore it is unnecessary there.
Personally, I use the CLS command at the beginning of my programs, just to be sure the screen is clean when the program runs. This is especially helpful when you are troubleshooting, and want to know what each run of the program actually accomplishes. Or, if you must run the program more than once.