This commit is contained in:
35
01_grundlagen/unterricht/tag07/13_volume-cube.html
Normal file
35
01_grundlagen/unterricht/tag07/13_volume-cube.html
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Kartonvolumen berechnen (cube)</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<main>
|
||||||
|
<div class="container py-5">
|
||||||
|
<h1>Kartonvolumen berechnen (cube)</h1>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<script>
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
// Konfigurationsvariablen
|
||||||
|
const BASE_COST_PER_UNIT = 0.7;
|
||||||
|
const COST_PER_CC = 0.001;
|
||||||
|
|
||||||
|
const length = 25;
|
||||||
|
const width = 30;
|
||||||
|
const height = 12;
|
||||||
|
|
||||||
|
// cubeVolume = length × width × height
|
||||||
|
const cartonVolume = length * width * height;
|
||||||
|
|
||||||
|
// shippingCost = volume × costPerCC + costPerUnit
|
||||||
|
const shippingCost = cartonVolume * COST_PER_CC + BASE_COST_PER_UNIT;
|
||||||
|
|
||||||
|
console.log(`shipping cost is: $${shippingCost.toFixed(2)}`); // => 9.70
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
61
01_grundlagen/unterricht/tag07/14_function-volume-cube.html
Normal file
61
01_grundlagen/unterricht/tag07/14_function-volume-cube.html
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Kartonvolumen berechnen mit Funktion (cube)</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<main>
|
||||||
|
<div class="container py-5">
|
||||||
|
<h1>Kartonvolumen berechnen mit Funktion (cube)</h1>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<script>
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
// Konfigurationsvariablen
|
||||||
|
const BASE_COST_PER_UNIT = 0.7;
|
||||||
|
const COST_PER_CC = 0.001;
|
||||||
|
|
||||||
|
const length = 25;
|
||||||
|
const width = 30;
|
||||||
|
const height = 12;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Funktion zum Berechnen einen Kartonvolumens
|
||||||
|
*/
|
||||||
|
const calcCubeVolume = (l, w, h) => {
|
||||||
|
// cubeVolume = length × width × height
|
||||||
|
const volume = l * w * h;
|
||||||
|
return volume;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Funktion zum Berechnen einen Kartonvolumens (Kurzschreibweise)
|
||||||
|
*/
|
||||||
|
const calcCubeVolumeShort = (l, w, h) => l * w * h;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Funktion zum Berechnen der Versandkosten
|
||||||
|
*/
|
||||||
|
const calcShippingCost = (volume) => {
|
||||||
|
// shippingCost = volume × costPerCC + costPerUnit
|
||||||
|
const cost = volume * COST_PER_CC + BASE_COST_PER_UNIT;
|
||||||
|
return cost;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Funktion zum Berechnen der Versandkosten (Kurzschreibweise)
|
||||||
|
*/
|
||||||
|
const calcShippingCostShort = (volume) => volume * COST_PER_CC + BASE_COST_PER_UNIT;
|
||||||
|
|
||||||
|
// const volume = calcCubeVolume(25, 30, 12);
|
||||||
|
const volume = calcCubeVolume(length, width, height);
|
||||||
|
// const volumeMiniPackage = calcCubeVolume(10, 5, 5);
|
||||||
|
|
||||||
|
console.log(`shipping cost is: $${calcShippingCost(volume).toFixed(2)}`); // => 9.70
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user