I need help java script

//Dog feeder - Depending on their weight and age, we need to know how many pounds of food to feed our dog each day!

/*

Use the hungryDog function and feeding requirements below to do the following:

  1. Invoke the hungryDog function below and pass it a weight value in pounds

  2. Also, pass to hungryDog an age value in years (note: if the dog is a puppy, the age will be a decimal. For example: three months = 3/12 or .25)

  3. Do the proper calculations and return the number of pounds of raw food to feed the dog/puppy in a day

  

  REMEMBER: This program should handle correctly adult AND puppy ages and weights

  

  Feeding Requirements:

  Adult Dogs 1 year and older 

     up to 5 lbs - 5% of their body weight

     6 - 10 lbs - 4% of their body weight 

     11 - 15 lbs - 3% of their body weight 

     > 15lbs - 2% of their body weight 

  Puppies less than 1 year

     2 - 4 months 10% of their body weight

     4 - 7 months 5% of their body weight 

     7 - 12 months 4% of their body weight

    

  NOTE: If done correctly, a weight of 15 lbs and age of 1 year would return 0.44999999999999996

*/  

function hungryDog(age, weight){
let dogFood = 

can someone help me with this?

Firstly, welcome to the forums.

While we are primarily here to help people with their Free Code Camp progress, we are open to people on other paths, too. Some of what you are asking is pretty trivial in the Free Code Camp context, so you might find that if you’re not getting the instruction and material you need in your current studies, the FCC curriculum will really help you get started. At a modest guess I’d say investing a 4-5 hours working through the curriculum here will really pay off. You can find the curriculum at https://www.freecodecamp.org/learn.

With your current questions, we don’t have enough context to know what you already know or don’t know, so it is impossible to guide you without just telling you the answer (which we won’t do).

It is pretty typical on here for people to share a codepen / repl.it / jsfiddle example of what they have tried so that anyone helping has more of an idea of what help is actually helpful.

Please provide some example of what you’ve tried and I’m sure you’ll get more help.

Happy coding :slight_smile:


I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

3 Likes

Hi again!

It looks like you are having some trouble getting started.

I would suggest writing down some pseudocode as a way to help explain what you hope to accomplish with this algorithm.

Once you have a game plan for this algorithm then it will be easier to implement it in code.

This is a good article on what pseudocode is.
How to write pseudocode

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.