Material Cost Calculator
About this app
Calculate the amount of materials and cost for various rooms in your home.
Material Cost Calculator Material Cost Calculator Room Name: Kitchen Bathroom Hallway Wardrobe Room Length (m): Width (m): Height (m): Calculate Costs
Related apps
Put this on your site
Source
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Material Cost Calculator</title>
<meta name="description" content="Calculate the amount of materials and cost for various rooms in your home.">
<meta name="keywords" content="Calculator, Materials, Cost, Room Measurements">
<!-- Libraries -->
<!-- jQuery (3.6.0) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js" crossorigin="anonymous"></script>
<!-- Bootstrap CSS (5.3.3) -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" crossorigin="anonymous">
<!-- Bootstrap JS (5.3.3) -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.min.js" crossorigin="anonymous">
</script>
<!-- Font Awesome (6.6.0) -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.6.0/css/fontawesome.min.css" crossorigin="anonymous">
<script type="text/javascript">
try {
// App Javascript Goes Here.
function calculateCost() {
let room = document.getElementById("room").value;
let length = parseFloat(document.getElementById("length").value);
let width = parseFloat(document.getElementById("width").value);
let height = parseFloat(document.getElementById("height").value);
if (isNaN(length) || isNaN(width) || isNaN(height)) {
alert("Please enter valid numbers for Length, Width and Height!");
return;
}
let area = length * width; // Room area in square meters
let volume = length * width * height; // Room volume in cubic meters
// average costs per square meter and cubic meter
let materialCostPerSquareMeter = 15; // Example cost
let workCostPerCubicMeter = 10; // Example cost
let totalMaterialCost = area * materialCostPerSquareMeter;
let totalWorkCost = volume * workCostPerCubicMeter;
document.getElementById("result").innerHTML = `
<h5>Calculator Results</h5>
<p>Room Type: ${room}</p>
<p>Area: ${area.toFixed(2)} m²</p>
<p>Volume: ${volume.toFixed(2)} m³</p>
<p>Total Materials Cost: $${totalMaterialCost.toFixed(2)}</p>
<p>Total Work Cost: $${totalWorkCost.toFixed(2)}</p>
`;
}
// This will run when the DOM is ready.
document.addEventListener("DOMContentLoaded", function() {
document.getElementById("calculateBtn").addEventListener("click", calculateCost);
});
} catch (error) {
throw error;
}
</script>
<style>
body {
background: linear-gradient(to right, #ff7e5f, #feb47b);
color: #333;
}
#main-container {
margin-top: 50px;
background-color: #fff;
padding: 30px;
border-radius: 10px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}
h1 {
color: #ff4747;
}
button {
background-color: #ff4747;
border: none;
color: white;
}
button:hover {
background-color: #d43737;
}
.result {
margin-top: 20px;
padding: 15px;
border: 1px solid #d3d3d3;
border-radius: 5px;
background-color: #e4ffe4;
}
</style>
</head>
<body>
<div id="main-container" class="container">
<h1>Material Cost Calculator</h1>
<form>
<div class="mb-3">
<label for="room" class="form-label">Room Name:</label>
<select class="form-select" id="room">
<option value="Kitchen">Kitchen</option>
<option value="Bathroom">Bathroom</option>
<option value="Hallway">Hallway</option>
<option value="Wardrobe">Wardrobe</option>
<option value="Room">Room</option>
</select>
</div>
<div class="mb-3">
<label for="length" class="form-label">Length (m):</label>
<input type="number" class="form-control" id="length" required>
</div>
<div class="mb-3">
<label for="width" class="form-label">Width (m):</label>
<input type="number" class="form-control" id="width" required>
</div>
<div class="mb-3">
<label for="height" class="form-label">Height (m):</label>
<input type="number" class="form-control" id="height" required>
</div>
<button type="button" id="calculateBtn" class="btn btn-primary">Calculate Costs</button>
</form>
<div id="result" class="result"></div>
</div>
</body>
</html>
NEW APPS
These are apps made by the community!