// === Conversion Tables ===
// Cardio: points → 1.5-mile run time (min:sec)
const cardioTable = {
50: "9:12", 45: "10:00", 40: "11:00", 35: "12:30",
30: "14:00", 25: "15:30", 20: "16:30", 15: "17:30", 10: "18:30"
};
// Upper Body: points → push-ups
const upperTable = {
15: 67, 14: 60, 13: 55, 12: 49,
11: 45, 10: 40, 9: 35, 8: 30, 7: 25, 6: 20, 5: 15, 4: 10
};
// Core: points → sit-ups
const coreTable = {
15: 58, 14: 54, 13: 50, 12: 45,
11: 42, 10: 38, 9: 34, 8: 30, 7: 25, 6: 20, 5: 15, 4: 10
};
// Converts points to reps or times based on table
function convert(points, table) {
const keys = Object.keys(table)
.map(Number)
.sort((a, b) => b - a);
for (let k of keys) {
if (points >= k) return table[k];
}
return "N/A";
}
// DOM elements
const formEl = document.getElementById("ptForm");
const ageEl = document.getElementById("age");
const resultsEl = document.getElementById("results");
formEl.addEventListener("submit", function(e) {
e.preventDefault();
calculateMinimums();
});
function calculateMinimums() {
const age = Number(ageEl.value);
if (!age) {
resultsEl.innerHTML = "Please enter your age.";
return;
}
// Max points per component
const maxCardio = 50;
const maxUpper = 15;
const maxCore = 15;
const targetScore = 75;
const assumption = document.querySelector(
'input[name="assumption"]:checked'
).value;
let cardioPts = 0, upperPts = 0, corePts = 0;
if (assumption === "cardio") {
cardioPts = maxCardio;
const remaining = targetScore - cardioPts;
upperPts = corePts = Math.ceil(remaining / 2);
}
if (assumption === "upper") {
upperPts = maxUpper;
const remaining = targetScore - upperPts;
cardioPts = Math.ceil(remaining / 2);
corePts = Math.ceil(remaining / 2);
}
if (assumption === "core") {
corePts = maxCore;
const remaining = targetScore - corePts;
cardioPts = Math.ceil(remaining / 2);
upperPts = Math.ceil(remaining / 2);
}
const cardioReq = convert(cardioPts, cardioTable);
const upperReq = convert(upperPts, upperTable);
const coreReq = convert(corePts, coreTable);
resultsEl.innerHTML = `
Minimum Performance to Reach 75:
Cardio (${cardioPts} pts): ${cardioReq}
Upper Body (${upperPts} pts): ${upperReq} reps
Core (${corePts} pts): ${coreReq} reps
Approximate standards for planning only.
`;
}