Bunun hikayesi biraz uzun daha sonra anlatırım ve gerçek yaşanmış bir olaydır.(Dershane öğrenci TRWE_2012'in 2000 yılında, parasızlıktan Adapazarı-Sapanca (16 KM) arasını yüreyerek eve varma hikayesidir.Bu yaşanmış olay, aynı zaman da "inatçılığın ve imkansızlığı, görünür kılmanın hikayesidir.)

Kod: Tümünü seç
# =====================================================================
# Calorie and Fat Burn Calculator (MET-based formula)
# Formula: Calories (kcal) = MET x Weight (kg) x Duration (hours)
# =====================================================================
[System.Threading.Thread]::CurrentThread.CurrentCulture = [System.Globalization.CultureInfo]::InvariantCulture
function Read-Number {
param(
[string]$Prompt
)
while ($true) {
$raw = Read-Host $Prompt
$value = 0.0
$ok = [double]::TryParse($raw, [System.Globalization.NumberStyles]::Float, [System.Globalization.CultureInfo]::InvariantCulture, [ref]$value)
if ($ok -and $value -gt 0) {
return $value
}
Write-Host "Invalid input. Please enter a positive number (use a dot as decimal separator, e.g. 5.5)." -ForegroundColor Yellow
}
}
function Get-MetValue {
param(
[double]$SpeedKmH
)
# Standard walking/light-jogging MET table based on pace
if ($SpeedKmH -lt 3.2) {
return 2.0 # very slow walk
} elseif ($SpeedKmH -lt 4.5) {
return 3.0 # slow-moderate walk
} elseif ($SpeedKmH -lt 5.5) {
return 3.5 # normal walk
} elseif ($SpeedKmH -lt 6.5) {
return 5.0 # brisk walk
} elseif ($SpeedKmH -lt 7.5) {
return 6.0 # very brisk walk / race walk
} elseif ($SpeedKmH -lt 8.5) {
return 7.0 # walk-jog transition
} else {
return 8.3 # light jogging pace
}
}
function Get-FatFraction {
param(
[double]$MetValue,
[bool]$IsFasted
)
# Heuristic: lower intensity -> higher relative fat oxidation
# Higher intensity -> more reliance on glycogen (carbohydrate)
$fraction = 0.0
if ($MetValue -le 3.0) {
$fraction = 0.65
} elseif ($MetValue -le 3.5) {
$fraction = 0.60
} elseif ($MetValue -le 5.0) {
$fraction = 0.55
} elseif ($MetValue -le 6.0) {
$fraction = 0.50
} elseif ($MetValue -le 7.0) {
$fraction = 0.45
} else {
$fraction = 0.40
}
if ($IsFasted) {
$fraction += 0.08
if ($fraction -gt 0.75) {
$fraction = 0.75
}
}
return $fraction
}
Clear-Host
Write-Host "=================================================================="
Write-Host " CALORIE AND FAT BURN CALCULATOR (MET-based)"
Write-Host " Formula: Calories = MET x Weight(kg) x Duration(hours)"
Write-Host "=================================================================="
Write-Host ""
$weightKg = Read-Number -Prompt "Enter your weight in kg"
$heightCm = Read-Number -Prompt "Enter your height in cm"
$distanceKm = Read-Number -Prompt "Enter the walking distance in km"
$durationHours = Read-Number -Prompt "Enter the duration in hours (e.g. 2.5 for 2h30m)"
$fastedInput = Read-Host "Did you walk on an empty stomach (fasted)? (y/n)"
$isFasted = $false
if ($fastedInput.Trim().ToLowerInvariant() -eq "y") {
$isFasted = $true
}
# --- Calculations ---
$speedKmH = $distanceKm / $durationHours
$metValue = Get-MetValue -SpeedKmH $speedKmH
$totalCalories = $metValue * $weightKg * $durationHours
$fatFraction = Get-FatFraction -MetValue $metValue -IsFasted $isFasted
$fatCalories = $totalCalories * $fatFraction
$fatGrams = $fatCalories / 9.0
$heightM = $heightCm / 100.0
$bmi = $weightKg / ($heightM * $heightM)
# --- Output ---
Write-Host ""
Write-Host "=================================================================="
Write-Host " RESULTS"
Write-Host "=================================================================="
Write-Host ("Walking speed : {0:N2} km/h" -f $speedKmH)
Write-Host ("Estimated MET value : {0:N1}" -f $metValue)
Write-Host ("BMI : {0:N1}" -f $bmi)
Write-Host ""
Write-Host ("Total calories burned : {0:N0} kcal" -f $totalCalories)
Write-Host ("Estimated fat share : {0:N0} %" -f ($fatFraction * 100))
Write-Host ("Calories from fat : {0:N0} kcal" -f $fatCalories)
Write-Host ("Equivalent fat mass : {0:N1} g" -f $fatGrams)
Write-Host "=================================================================="
Write-Host ""
Write-Host "Note: This is an estimation tool for general informational purposes only."
Write-Host "It does not replace medical or professional nutritional advice."
Write-Host ""
Read-Host "`nPress ENTER to exit."



