(*************************************************************************) (* *) (* Michael LeBeane *) (* Grade 10 *) (* Tayllorville High School #7120 *) (* Contest 1 - ACSL Post Office *) (* Intermediate 3 *) (* *) (* *) (*************************************************************************) program PostOffice (Input, Output); Uses CRT; Var Length, Width, Thickness, Weight, Cost :Real; K :Integer; begin {begins main program} clrscr; K:= 1; While K <= 5 do begin {begins post office loop} Cost := 0; WriteLn; Write ('Enter the length '); ReadLn (Length); Write ('Enter the width '); ReadLn (Width); Write ('Enter the thickness '); ReadLn (Thickness); Write ('Enter the weight in pounds '); ReadLn (Weight); WriteLn; if (Length >= 3.5) and (Length <= 4.25) then if (Width >= 3.5) and (Width <= 6) then if (Thickness >= 0.007) and (Thickness <= 0.016) then begin {Calculates post card cost} if (round(Weight / 0.0625)) >= (Weight / 0.0625) then Cost := round(Weight / 0.0625) * 0.20 else Cost := (round(Weight / 0.0625) + 1) * 0.20; WriteLn ('$',Cost:1:2); end; {Ends calculations} if (Length > 4.25) and (Length <= 6) then if (Width > 6) and (Width <= 11.5) then if (Thickness >= 0.007) and (Thickness <= 0.016) then begin {Calculates large post card cost} if (round(Weight / 0.0625)) >= (Weight / 0.0625) then Cost := round(Weight / 0.0625) * 0.30 else Cost := (round(Weight / 0.0625) + 1) * 0.30; WriteLn ('$',Cost:1:2); end; {Ends calculations} if (Length >= 3.5) and (Length <= 6.125) then if (Width >= 5) and (Width <= 11.5) then if (Thickness > 0.016) and (Thickness <= 0.25) then begin {Calculates envolope cost} if (round(Weight / 0.0625)) >= (Weight / 0.0625) then Cost := round(Weight / 0.0625) * 0.47 else Cost := (round(Weight / 0.0625) + 1) * 0.47; WriteLn ('$',Cost:1:2); end; {Ends calculations} if (Length > 6.125) and (Length <= 24) then if (Width >= 11) and (Width <= 18) then if (Thickness >= 0.25) and (Thickness <= 0.5) then begin {Calculates large envolope cost} if (round(Weight / 0.0625)) >= (Weight / 0.0625) then Cost := round(Weight / 0.0625) * 0.56 else Cost := (round(Weight / 0.0625) + 1) * 0.56; WriteLn ('$',Cost:1:2); end; {Ends calculations} if (Length > 24) or (Width > 18) or (Thickness > 0.5) then if Length + Width + Width + Thickness + Thickness <= 84 then begin {Calculates package cost} if (round(Weight / 0.50)) >= (Weight / 0.50) then Cost := round(Weight / 0.50) * 1.50 else Cost := (round(Weight / 0.50) + 1) * 1.50; WriteLn ('$',Cost:1:2); end; {Ends calculations} if (Length > 24) or (Width > 18) or (Thickness > 0.5) then if (Length + Width + Width + Thickness + Thickness >= 84) and (Length + Width + Width + Thickness + Thickness <= 130) then begin {Calculates large package cost} if (round(Weight / 0.50)) >= (Weight / 0.50) then Cost := round(Weight / 0.50) * 1.75 else Cost := (round(Weight / 0.50) + 1) * 1.75; WriteLn ('$',Cost:1:2); end; {Ends calculations} if Cost = 0 then WriteLn ('UNMAILABLE'); K := K +1 end; {Ends post office loop} ReadLn; end. {Ends main program}