Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Costco recently made news for advertising a $6,000 doomsday meal kit. The kit is

ID: 3713897 • Letter: C

Question

Costco recently made news for advertising a $6,000 doomsday meal kit. The kit is advertised as featuring enough food to feed a family of one for four years. We’ll assume each meal kit is about 1500 calories. Ever wonder how many meal kits you’ll need to survive a zombie apocalypse that lasted for 50 years? Let’s find out! 1. Recreate the below page (Before Calculation) as shown. Name this web page Homework 14 and save it to your Contents/Week9 folder. 2. Please include your name in your web page code. 3. Write a JavaScript function named calcSupply that accepts the following parameters: a. Your age in years stored into a variable a. Your maximum age in years (Your age + 50 years) stored into a variable b. Estimated number of meal kits you would eat a day stored as a number c. Calculate the amount of meal kits you would need for the next 50 years. We’ll assume there are no leap years. d. Outputs the result to the screen like so "You will need #TotalMeals to last you until the age of maxAge (see After Calculation). e. You can reference JavaScript Arithmetic and Functions at http://www.w3schools.com. 4. When the calculate button is clicked it performs a calculation to calculate the amount of meal kits you’d need to survive a zombie apocalypse lasting 50 years. 5. Your JavaScript function should be external to your HTML file and saved in the scripts folder. script file to its appropriate folder.

Food Supply Calculator Ever wonder how much food you would need to survive a zombie apocalypse that lasted 50 years? Let's find out! l am years old. I'd eat meal kits a day. CALCULATE You will need meal kits to last you until the age of RESET

Explanation / Answer

<!DOCTYPE html>
<html>
<head>

<script src="myScript.js"></script>
</head>
<body>
<P2><center>Ever wonder how much food you would need to survive a zombie apocalypse that lasted 50 years?</center></p2>
<br><br>
<p4><center>Let's find out!</center> </p4>
<form name="myForm" method="post">
<center>I am <input type="text" name="age" placeholder="Age"> years old.I'd <input type="text" name="day" placeholder="#/day"> kits a day <br><br>

<center><input type="submit" value="Calculate"> <br><br>

<center>You will need <input type="text" id="age1" name="age1"> meal kits to last you until the age of <input type="text" id="day1" name="day1">
<br><br>
<center><input type="reset" value="RESET">
</form>


</body>

</html>

myScript.js

--------------

function validateForm() {
    var x = document.forms["myForm"]["age"].value;
    var y= document.forms["myForm"]["day"].value;
    if (x == "") {
        alert("Age must be filled out");
        return false;
    }
     if (y== "") {
        alert("day must be filled out");
        return false;
    }
   
    document.getElementById("age1").innerHTML = x+50;
    document.getElementById("day1").innerHTML = y;
}