program SteelCost; { program computing cost of steel needed for a lot of ballbearings and one of roller bearings. R. Rosebrugh September 28, 1993} const Pi = 3.14159; Price = 0.52; {price per cc of steel - the units used below} var BBRadius, RBRadius, RBLength : Real; {input - radii in cm } BBLotsize, RBLotSize : Integer; {input - numbers required} BBVolume, RBVolume, Cost : Real; {output - volumes and cost} procedure ReadNumbersSizes; {get input values for lots and dimensions} begin WriteLn ('Type the radius (decimal number) in centimetres'); WriteLn ('and lot size (whole number) for ball bearings'); ReadLn (BBRadius,BBLotsize); WriteLn; WriteLn ('Type the radius and length (decimal numbers) in centimetres'); WriteLn ('and lot size (whole number) for roller bearings'); ReadLn (RBRadius,RBLength,RBLotsize); end; procedure Steelvolume; {compute volume of ball bearings and roller bearings} begin BBVolume := 4/3*Pi*BBRadius*BBRadius*BBRadius*BBLotsize; RBVolume := Pi*RBRadius*RBRadius*RBLength*RBLotsize; end; begin{main program} ReadNumbersSizes; Steelvolume; {compute cost and report it} Cost := (BBVolume + RBVolume) * Price; WriteLn; WriteLn ('The required steel for ', BBLotSize:3, BBRadius:5:2, ' cm ball bearings and'); Writeln (' ', RBLotsize:3, RBRadius:5:2,' cm by ',RBLength:5:2,' cm roller bearings'); Writeln ('costs $', Cost:5:2); {Hold output on screen:} WriteLn; WriteLn('Press return to continue'); ReadLn; end.