Home vs. Gym Workout Cost Analyzer

Home vs. Gym Workout Cost Analyzer

Setup & Common Inputs

The number of years you want to compare costs for.

Home Workout Costs

Initial Equipment Costs

Total Initial Equipment: $0.00

Ongoing Home Workout Costs

Gym Membership Costs

Optional Other Gym-Related Costs

Comparison & Report

Home Workout

Calculations will appear here.

Gym Membership

Calculations will appear here.

Comparison summary will appear here.

Comparison Period: ${data.comparisonPeriodYears} years

Initiation/Upfront Fees: $${gym.initiationFee.toFixed(2)}

Monthly Membership Fee: $${gym.monthlyFee.toFixed(2)}

Annual Fee: $${gym.annualFee.toFixed(2)}

Monthly Transport Cost: $${gym.monthlyTransport.toFixed(2)}

Monthly Extras Cost: $${gym.monthlyExtras.toFixed(2)}

Total Ongoing Monthly (Fee+Transport+Extras): $${gym.totalMonthlyOngoing.toFixed(2)}


Total Gym Cost: $${gym.totalCost.toFixed(2)}

Average Monthly Cost: $${gym.avgMonthlyCost.toFixed(2)}

`; const summaryDiv = document.getElementById('hgwcComparisonSummary'); let summaryText = `Over ${data.comparisonPeriodYears} years: Home workouts average $${home.avgMonthlyCost.toFixed(2)}/month (Total: $${home.totalCost.toFixed(2)}).
Gym membership averages $${gym.avgMonthlyCost.toFixed(2)}/month (Total: $${gym.totalCost.toFixed(2)}).

`; const difference = Math.abs(home.totalCost - gym.totalCost); if (home.totalCost < gym.totalCost) { summaryText += `Home workouts are projected to be $${difference.toFixed(2)} cheaper overall.`; } else if (gym.totalCost < home.totalCost) { summaryText += `Gym membership is projected to be $${difference.toFixed(2)} cheaper overall.`; } else { summaryText += `Both options have similar projected total costs.`; } summaryDiv.innerHTML = summaryText; } function hgwc_generatePdf() { const data = hgwc_calculateCosts(); const home = data.home; const gym = data.gym; const { jsPDF } = window.jspdf; const doc = new jsPDF(); let yPos = 20; const primaryColor = getComputedStyle(document.documentElement).getPropertyValue('--primary-color').trim(); const accentColor = getComputedStyle(document.documentElement).getPropertyValue('--accent-color').trim(); const textColor = getComputedStyle(document.documentElement).getPropertyValue('--text-color').trim(); doc.setFontSize(20); doc.setTextColor(primaryColor); doc.text("Home vs. Gym Workout Cost Analysis", doc.internal.pageSize.getWidth() / 2, yPos, { align: 'center' }); yPos += 10; doc.setFontSize(12); doc.setTextColor(textColor); doc.text(`Comparison Period: ${data.comparisonPeriodYears} years`, doc.internal.pageSize.getWidth() / 2, yPos, { align: 'center' }); yPos += 15; // Home Workout Section doc.setFontSize(16); doc.setTextColor(primaryColor); doc.text("Home Workout Costs", 14, yPos); yPos += 8; doc.setFontSize(10); doc.setTextColor(textColor); doc.text(`Initial Equipment Costs Total: $${home.initialEquipment.toFixed(2)}`, 14, yPos); yPos += 6; if (home.equipmentList.length > 0) { const equipmentData = home.equipmentList.map(eq => [eq.name, `$${eq.cost.toFixed(2)}`]); doc.autoTable({ startY: yPos, head: [['Equipment Item', 'Cost']], body: equipmentData, theme: 'grid', headStyles: {fillColor: [200,200,200], textColor: [0,0,0], fontSize:9}, styles: {fontSize: 8, cellPadding: 1.5}, margin: {left: 14, right: 14}, tableWidth: 'auto', didDrawPage: (d) => { yPos = d.cursor.y; } }); yPos = doc.lastAutoTable.finalY + 6; } if (yPos > 270) { doc.addPage(); yPos = 20; } doc.text(`Monthly Online Subscriptions: $${home.monthlySubCost.toFixed(2)}`, 14, yPos); yPos += 6; doc.text(`Annual Upgrade/Misc. Cost: $${home.annualUpgradeCost.toFixed(2)}`, 14, yPos); yPos += 6; doc.text(`Total Ongoing Costs (over ${data.comparisonPeriodYears} yrs): $${home.totalOngoing.toFixed(2)}`, 14, yPos); yPos += 8; doc.setFont(undefined, 'bold'); doc.text(`Total Home Workout Cost: $${home.totalCost.toFixed(2)}`, 14, yPos); yPos += 6; doc.text(`Average Monthly Home Cost: $${home.avgMonthlyCost.toFixed(2)}`, 14, yPos); yPos += 10; doc.setFont(undefined, 'normal'); // Gym Membership Section if (yPos > 240) { doc.addPage(); yPos = 20; } doc.setFontSize(16); doc.setTextColor(primaryColor); doc.text("Gym Membership Costs", 14, yPos); yPos += 8; doc.setFontSize(10); doc.setTextColor(textColor); doc.text(`Initiation/Upfront Fees: $${gym.initiationFee.toFixed(2)}`, 14, yPos); yPos += 6; doc.text(`Monthly Membership Fee: $${gym.monthlyFee.toFixed(2)}`, 14, yPos); yPos += 6; doc.text(`Annual Fee: $${gym.annualFee.toFixed(2)}`, 14, yPos); yPos += 6; doc.text(`Monthly Transportation Cost: $${gym.monthlyTransport.toFixed(2)}`, 14, yPos); yPos += 6; doc.text(`Monthly Extras Cost: $${gym.monthlyExtras.toFixed(2)}`, 14, yPos); yPos += 6; doc.text(`Total Ongoing Monthly (Fee+Transport+Extras): $${gym.totalMonthlyOngoing.toFixed(2)}`, 14, yPos); yPos += 8; doc.setFont(undefined, 'bold'); doc.text(`Total Gym Membership Cost: $${gym.totalCost.toFixed(2)}`, 14, yPos); yPos += 6; doc.text(`Average Monthly Gym Cost: $${gym.avgMonthlyCost.toFixed(2)}`, 14, yPos); yPos += 10; doc.setFont(undefined, 'normal'); // Summary Comparison if (yPos > 250) { doc.addPage(); yPos = 20; } doc.setFontSize(14); doc.setTextColor(primaryColor); doc.text("Overall Comparison", 14, yPos); yPos += 8; doc.setFontSize(11); doc.setTextColor(textColor); const difference = Math.abs(home.totalCost - gym.totalCost); let conclusion = ""; if (home.totalCost < gym.totalCost) { conclusion = `Home workouts are projected to be $${difference.toFixed(2)} cheaper overall.`; } else if (gym.totalCost < home.totalCost) { conclusion = `Gym membership is projected to be $${difference.toFixed(2)} cheaper overall.`; } else { conclusion = `Both options have similar projected total costs.`; } doc.text(`Home Total: $${home.totalCost.toFixed(2)} (Avg Monthly: $${home.avgMonthlyCost.toFixed(2)})`, 14, yPos); yPos +=7; doc.text(`Gym Total: $${gym.totalCost.toFixed(2)} (Avg Monthly: $${gym.avgMonthlyCost.toFixed(2)})`, 14, yPos); yPos +=7; doc.setFont(undefined, 'bold'); doc.setTextColor(accentColor); doc.text(conclusion, 14, yPos); doc.save('home_vs_gym_cost_analysis.pdf'); } // Initialize document.addEventListener('DOMContentLoaded', () => { hgwc_showTab(0); hgwc_renderEquipmentList(); // For initial empty state hgwc_updateTotalInitialEquipmentCost(); // Demo data hgwc_homeEquipment.push({id: 'eq_001', name: 'Yoga Mat', cost: 25}); hgwc_homeEquipment.push({id: 'eq_002', name: 'Dumbbell Set (Adjustable)', cost: 150}); hgwc_renderEquipmentList(); hgwc_updateTotalInitialEquipmentCost(); });
Scroll to Top