Question
JavaScript Codes?
Ever wonder how much a lifetime supply of your favorite snack is? Wonder no more! • Write a function named calculateSupply
0 0
Add a comment Improve this question Transcribed image text
Answer #1

var MAX_AGE = 80; You will need 10950 to last you until the ripe old age of 80 You will need 2920 to last you until the ripe


var MAX_AGE = 80;

function calculateSupply(age, q)
{
   var years = MAX_AGE - age;
  
   return "You will need " + 365*years*q + " to last you until the ripe old age of " + MAX_AGE;
}

document.write(calculateSupply(50, 1)+"</br>");
document.write(calculateSupply(0, .1)+"</br>");
document.write(calculateSupply(79, 1)+"</br>");

// Please up vote.

Add a comment
Know the answer?
Add Answer to:
JavaScript Codes? Ever wonder how much a "lifetime supply" of your favorite snack is? Wonder no...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • The following are screen grabs of the provided files Thanks so much for your help, and have a n...

    The following are screen grabs of the provided files Thanks so much for your help, and have a nice day! My Java Programming Teacher Gave me this for practice before the exam, butI can't get it to work, and I need a working version to discuss with my teacher ASAP, and I would like to sleep at some point before the exam. Please Help TEST QUESTION 5: Tamagotchi For this question, you will write a number of classes that you...

  • C++ please Programming Assignment #6 Help Me Find The Secret Message Description: This assignment will require...

    C++ please Programming Assignment #6 Help Me Find The Secret Message Description: This assignment will require that you read in an encrypted message from a file, decode the message, and then output the message to a file. The encryption method being used on the file is called a shift cipher (Info Here). I will provide you with a sample encrypted message, the offset, and the decrypted message for testing. For this project I will provide you main.cpp, ShiftCipher.h, and ShiftCipher.cpp....

  • Assignment Predator / Prey Objectives Reading from and writing to text files Implementing mathematical formulas in...

    Assignment Predator / Prey Objectives Reading from and writing to text files Implementing mathematical formulas in C++ Implementing classes Using vectors Using command line arguments Modifying previously written code Tasks For this project, you will implement a simulation for predicting the future populations for a group of animals that we’ll call prey and their predators. Given the rate at which prey births exceed natural deaths, the rate of predation, the rate at which predator deaths exceeds births without a food...

  • You need not run Python programs on a computer in solving the following problems. Place your...

    You need not run Python programs on a computer in solving the following problems. Place your answers into separate "text" files using the names indicated on each problem. Please create your text files using the same text editor that you use for your .py files. Answer submitted in another file format such as .doc, .pages, .rtf, or.pdf will lose least one point per problem! [1] 3 points Use file math.txt What is the precise output from the following code? bar...

  • Can you please show how to do the calculations I sent for run 2. al values ofc where the o the maxi...

    Can you please show how to do the calculations I sent for run 2. al values ofc where the o the maximum ot minim changes? lluirate by ggh ily gven by the oquatice lcrmining the transinoal f inflection poses change abe famly to see whas shand oonal value of c at whi unges. Try to discover i a have discoveed anomials given by the oqu Er what values of c does Exp Background Information We A chemical reaction involves breaking,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT