WITH Ada.Text_IO; WITH Ada.Float_Text_IO;
-------------------------------------------------
-- Program asks the user how many yards they ran
-- and how many seconds it took them.
-- Program outputs their speed in MPH.
-------------------------------------------------
PROCEDURE program2 IS
mph, feet, yards, sec : Float;
BEGIN
Ada.Text_IO.Put(Item=>"How many yards did you run? ");
Ada.Float_Text_IO.Get(Item=>yards);
Ada.Text_IO.New_Line;
Ada.Text_IO.Put(Item=>"How many seconds did it take you to complete? ");
Ada.Float_Text_IO.Get(Item=>sec);
Ada.Text_IO.New_Line;
-- there are 3 feet in a yard
feet:=yards*3.0;
-- there are 3600 seconds in an hour
-- there are 5280 feet per mile
mph:=(3600.0*(feet/sec))/5280.0;
Ada.Text_IO.Put(Item=>"The average speed in mph was ");
Ada.Float_Text_IO.Put(Item=>mph,fore=>1,aft=>2,exp=>0);
END program2;