with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Float_Text_IO; use Ada.Float_Text_IO;
procedure Cycling_Stats is
Distance : Float; -- kilometers
Time_Hours : Float;
Avg_Speed : Float;
Weight : Float; -- rider weight in kg
Calories : Float;
begin
Put_Line("🚴♂️ Cycling Stats Calculator");
Put("Enter distance (km): ");
Get(Distance);
Put("Enter time (hours): ");
Get(Time_Hours);
Put("Enter your weight (kg): ");
Get(Weight);
if Time_Hours > 0.0 then
Avg_Speed := Distance / Time_Hours;
else
Avg_Speed := 0.0;
end if;
-- Simple calories estimate:
-- calories ≈ MET(=8.0) × weight(kg) × time(hr)
Calories := 8.0 * Weight * Time_Hours;
Put_Line("");
Put_Line("📊 Results:");
Put("Average Speed: ");
Put(Avg_Speed, Fore => 1, Aft => 2, Exp => 0);
Put_Line(" km/h");
Put("Estimated Calories Burned: ");
Put(Calories, Fore => 1, Aft => 2, Exp => 0);
Put_Line(" kcal");
end Cycling_Stats;
Just something I scribbled while waiting for my eggs to poach this morning.