If anyone reads this site (HA!)
Manual Html Coding IS A Bitch!!!!!!! (mhcisab)
As
"they"
Say . . .
lol!
Heh
Not really!
Smiley Goes Here (SGH) :D
Have a great day, and may the world bless you.
Or something!
Please hit your back button.

"The only thing better than sloppy minutes is sloppy coding"
uses printer; (* Includes support from printer.fpd file *)
CONST
SPNum = 25; (* Number of salespeople maximum *)
WeekNum = 6; (* Number of weeks in contest *)
TYPE
SPRange = 1..SPNum;
WeekRange = 1..WeekNum;
SPType = ARRAY[SPRange, WeekRange] OF REAL;
WWType = ARRAY[WeekRange] OF INTEGER;
VAR
Sales : SPType; (* SalesPerson by week array *)
WeekWin : WWType; (* Keep track of weekly winners *)
SalesPerson, (* Salesperson *)
BoxesSold, (* How many boxes sold *)
WhichWeek, (* Which week it is *)
HowMany : INTEGER; (* For Writes and WriteP *)
PricePerBox, (* Cost of each box *)
TotalAmount : REAL; (* Total dollar amount sold *)
(*********************************************************)
PROCEDURE Writes(HowMany : INTEGER);
VAR
Count : INTEGER;
BEGIN (* Writes *)
Count := 0;
WHILE Count < HowMany DO
BEGIN
WRITELN;
Count := Count + 1;
END;
END; (* Writes *)
(*********************************************************)
PROCEDURE WritesP(HowMany : INTEGER);
VAR
Count : INTEGER;
BEGIN (* WritesP *)
Count := 0;
WHILE Count < HowMany DO
BEGIN
WRITELN(lst,' ');
Count := Count + 1;
END;
END; (* WritesP *)
(*********************************************************)
PROCEDURE Init(VAR Sales : SPType;
VAR WeekWin : WWTYpe;
VAR SalesPerson, BoxesSold, WhichWeek, HowMany : INTEGER;
VAR PricePerBox, TotalAmount : REAL);
VAR
Person : SPRange;
Week,
Win : WeekRange;
BEGIN (* Init *)
Writes(8);
WRITELN(' Welcome to the 2nd annual Cookie Selling Contest!');
WRITELN;
SalesPerson := 1;
BoxesSold := 0;
WhichWeek := 1;
HowMany := 0;
PricePerBox := 0.0;
TotalAmount := 0.0;
FOR Person := 1 TO SPNum DO (* Zero out all Sales elements *)
FOR Week := 1 TO WeekNum DO
Sales[Person, Week] := 0.0;
FOR Win := 1 TO WeekNum DO (* Zero out all WeekWin elements *)
WeekWin[Win] := 0;
Writes(2);
END; (* Init *)
(*********************************************************)
PROCEDURE GetData (VAR Sales : SPType;
SalesPerson, BoxesSold, WhichWeek : INTEGER;
PricePerBox, TotalAmount : REAL);
BEGIN (* GetData *)
Writes(4);
WRITELN(' Please input the salesperson number, the number of boxes that person');
WRITELN(' sold, the cost of the boxes, and the week the boxes were sold. For');
WRITELN(' example, if salesperson 2 sold 12 boxes at $1.50 each, in week 3,');
WRITELN(' enter 2 12 1.50 3');
WRITELN;
WRITELN(' Do NOT enter anything other than spaces between the numbers.');
WRITELN;
WRITE(' Enter ', SPNum, ' people or less. When it is the end of the data,');
WRITELN(' enter 0 0 0 0');
WRITELN;
WRITELN(' Press Enter or Return when finished with each entry.');
WRITELN;
REPEAT
WRITE(' ');
READLN(SalesPerson, BoxesSold, PricePerBox, WhichWeek);
IF (SalesPerson = 0) AND (BoxesSold = 0) AND (PricePerBox= 0) AND
(WhichWeek =0)
THEN
WRITELN (* If end of data, don't do anything with array *)
ELSE IF (SalesPerson < 1) OR (SalesPerson > SPNum) OR (WhichWeek < 0)
OR (WhichWeek > WeekNum)
THEN
WRITELN(' Invalid data. Input ignored.')
ELSE
BEGIN
TotalAmount := BoxesSold * PricePerBox;
Sales[SalesPerson, WhichWeek] := TotalAmount;
END;
UNTIL (SalesPerson = 0) AND (BoxesSold = 0) AND (PricePerBox = 0)
AND (WhichWeek = 0); (* Stop now *)
WRITELN;
WRITELN(' Your results are on the printer. ');
END; (* GetData *)
(*********************************************************)
PROCEDURE CalculateWinners (VAR Sales : SPType;
VAR WeekWin : WWType);
VAR
Person : SPRange;
Week : WeekRange;
Total : REAL;
BEGIN (* CalculateWinners *)
FOR Week := 1 to WeekNum DO
BEGIN
Total := 0.0;
FOR Person := 1 to SPNum DO
IF Sales[Person, Week] > Total
THEN
BEGIN
WeekWin[Week] := Person;
Total := Sales[Person, Week];
END;
END;
END; (* CalculateWinners *)
(*********************************************************)
PROCEDURE PrintOut (VAR Sales : SPType;
VAR WeekWin : WWType);
VAR
Person : SPRange;
Week,
Win : WeekRange;
BEGIN (* PrintOut *)
WritesP(2);
WRITELN(lst, ' The Yummy Cookie Company Sales Contest');
WRITELN(lst, ' ');
WRITELN(lst, ' Salesperson Week1 Week2 Week3 Week4 Week5 Week6');
FOR Person := 1 TO SPNum DO
BEGIN
IF (Person > 0) OR (Person < 10) (* Push 1-9 over farther *)
THEN
WRITE(lst, ' ', Person:7)
ELSE
WRITE(lst, ' ', Person:6);
FOR Week := 1 TO WeekNum DO
BEGIN
WRITE(lst, Sales[Person, Week]:10:2);
END;
WRITELN(lst, ' ');
END;
WritesP(2);
FOR Win := 1 TO WeekNum DO
BEGIN
WRITELN(lst, ' ');
WRITELN(lst, ' The winner for week number ', Win, ' is salesperson ', WeekWin[Win], '.');
END;
END; (* PrintOut *)
(*********************************************************)
BEGIN (* Contest *)
Init(Sales, WeekWin, SalesPerson, BoxesSold, WhichWeek, HowMany, PricePerBox, TotalAmount);
GetData(Sales, SalesPerson, BoxesSold, WhichWeek, PricePerBox, TotalAmount);
CalculateWinners(Sales, WeekWin);
PrintOut(Sales, WeekWin);
END. (* Contest *)
And may you have to learn how to code in dBase and ADA for the rest of your days.
-- Ancient Irish Curse.