REM ***********************************************
REM *** ACSL Program 1 Int. - Andrew Meglathery -C.Weiser HS***
REM ***********************************************
DIM loc(2),day(2),start$(2),start(2),end$(2),end(2),hours(2),pay(2),sflag(2),eflag(2)
DO
LET count=count+1 ! Check how many times the program has run
PRINT count;
INPUT loc(1),day(1),start$(1),end$(1),loc(2),day(2),start$(2),end$(2)
LET sflag(1)=0 ! Initialize the flag for the start time of the first day as 0
LET sflag(2)=0 ! Initialize the flag for the start time of the second day as 0
LET eflag(1)=0 ! Initialize the flag for the end time of the first day as 0
LET eflag(2)=0 ! Initialize the flag for the end time of the second day as 0
FOR i=1 to 2
FOR j=1 to 8
IF start$(i)=CHR$(64+j) then ! Check if any of the times are a capital letter
LET start(i)=13+(.5*j) ! Since A is 1:30, this adds 13 hours and then a half for each increasing letter as a number variable
LET sflag(i)=1 ! Set the flag to know that the start time code for a specific day is a letter
END IF ! Make two separate if statements so it will check each one
IF end$(i)=CHR$(64+j) then
LET end(i)=13+(.5*j)
LET eflag(i)=1
END IF
NEXT j
NEXT i
FOR i=1 to 2
FOR j=1 to 9
IF sflag(i)=0 then ! Only look for the value of the string if it's NOT a letter
IF VAL(start$(i))=j then LET start(i)=8.5+(.5*j) ! Let the start time be recorded as number variable starting at 9
END IF
IF eflag(i)=0 then
IF VAL(end$(i))=j then LET end(i)=8.5+(.5*j)
END IF
NEXT j
NEXT i
LET hours(1)=end(1)-start(1) ! Find the number of hours for the first day
LET hours(2)=end(2)-start(2) ! Find the number of hours for the second day
FOR i=1 to 2
IF loc(i)>=100 and loc(i)<=199 then
IF hours(i)<=5 then ! For normal pay
LET pay(i)=10*hours(i)
ELSE ! For overtime pay
LET pay(i)=15*(hours(i)-5)+50
END IF
ELSE IF loc(i)>=200 and loc(i)<=299 then
IF hours(i)<=6 then ! For normal pay
LET pay(i)=7.5*hours(i)
ELSE ! For overtime pay
LET pay(i)=15*(hours(i)-6)+45
END IF
ELSE IF loc(i)>=300 and loc(i)<=399 then
IF hours(i)<=4 then ! For normal pay
LET pay(i)=9.25*hours(i)
ELSE ! For overtime pay
LET pay(i)=10.5*(hours(i)-4)+37
END IF
ELSE IF loc(i)>=400 and loc(i)<=499 then
IF day(i)=1 or day(i)=7 then ! For overtime pay
LET pay(i)=13.5*hours(i)
ELSE ! For normal pay
LET pay(i)=6.75*hours(i)
END IF
ELSE IF loc(i)>=500 and loc(i)<=599 then
IF hours(i)<=6 then ! For normal pay
LET pay(i)=8*hours(i)
ELSE ! For overtime pay
LET pay(i)=12*(hours(i)-6)+48
END IF
END IF
NEXT i
LET total=pay(1)+pay(2) ! Find the total
LET total=ROUND(total,2) ! Round it to two decimal places at the end
PRINT count;
PRINT USING "$###.##":total ! Display it with a $ and the digits
LOOP
END