Piecework workers are paid by the piece. Often, workers who produce a greater quantity of output are paid at a higher rate.
1-199 pieces completed $.50
600 or more $.65
INPUT: for reach worker, input the name and number of pieces completed. Data may be entered with READ or INPUT statements.
OUTPUT: Print an appropriate title and column headings. There should be one detail line for each worker, which shows the name, the number of pieces, and the amount earned. compute and print totals of the number of pieces and the dollar amount earned.
Processing: For each Person, compute the pay earned by multiplying the number of pieces by the appropriate price. Accumulate the total number of pieces and the total dollar amount paid.
' ***** Program Mainline ***** CLS GOSUB InitializeVariables GOSUB PrintHeadings GOSUB ProcessDetail GOSUB PrintTotals END ' ***** Initialize Variables ***** InitializeVariables: Pieces = -1 TotPieces = 0 TotPay = 0 T1$ = " PieceWork Weekly Report" H1$ = " NAME Pieces PAY" D1$ = "\ \ ### ###" TL$ = " TOTALS ### ###" RETURN ' ***** Print Headings *** PrintHeadings: PRINT PRINT T1$ PRINT PRINT H1$ PRINT PRINT RETURN ' ***** Process Detail *** ProcessDetail: GOSUB ReadData DO UNTIL UCASE$(NAM$) = "END" GOSUB CalculateAnswer GOSUB PrintDetail GOSUB ReadData LOOP RETURN ' ***** Read Input Data **** ReadData: READ Nam$, Pieces DATA JOHNNY BEGOOD, 265 DATA SALLY GREAT, 650 DATA SAM KLUTZ, 177 DATA PETE PRECISE, 400 DATA FANNIE FANTASTIC, 399 DATA MORRIE MELLOW, 200 DATA END, 0 RETURN ' ***** Calculate Answer ***** CalculateAnswer: IF "Pieces" < "199" And "Peices" > "0" THEN PAY = Peices * .50 ELSE IF "Pieces" < "399" And "Peices" > "199" THEN PAY = Peices * .55 ELSE IF "Pieces" < "599" And "Peices" > "399" THEN PAY = Peices * .60 ELSE IF "Pieces" > "600" THEN PAY = Peices * .65 RETURN ' ***** Print Detail ***** PrintDetail: PRINT USING D1$; Nam$, Pieces, Pay RETURN ' ***** Print Totals ***** PrintTotals: PRINT PRINT PRINT RETURN ' ***** End of Program *****
PLEASE Help thanks
This post has been edited by modi123_1: 30 June 2014 - 12:28 PM
Reason for edit:: please use the 'code' button in the editor