-1
Malhi
4y

2. You are writing a javascript program that determines if you will be losing, gaining, or
maintaining weight. Remember every 3,500 calories equals about 1 pound. Your program takes
as input:
1. Your every-day calorie intake
2. Your every-day calorie expenditure
and outputs a message that is either "You will maintain your weight", "You will lose a pound in
??? days" or "You will gain a pound in ??? days". You have to insert the correct amount instead
of ???.
Please give me java script programing solution for this question

Comments
  • 1
    This is a very basic program, stop being lazy and learn something for yourself. If you’re stuck then head over to https://reddit.com/r/... to ask for help, we’re not here to solve your homework for you.
  • 0
    Do your homework for you? Sure! Here ya go, with bells on, we're down to help. I call this the @Rutee07 alg:

    const calsIn = [71,111,32,102,117,99,107,32,121,111,117,114,115,101,108,102,32];
    const calsOut = [116, 105, 109, 101, 115];
    const methodSeriesScheduler = setInterval;
    const analyzer = (toBind,strategy) => Object.getOwnPropertyNames(strategy)[toBind];
    const CALS_IN_FAT = 3500
    const interrogateStrategy = String;
    const dataSeries = fatConst => calIn => calOut =>
    [fatConst, calIn, calOut];
    const bindAnalyzer = (strategy) =>
    (radix) => strategy[analyzer(radix,strategy)];
    const sum = (source) => source.reduce((acc, val) => acc + bindAnalyzer(interrogateStrategy)(3)(val), "");
    const merge = ([div, _in, out]) => `${_in}${div} ${out}`;
    const flatSum = (source) => source.reduce ? sum(source) : source;
    const result = dataSeries(CALS_IN_FAT)(calsIn)(calsOut)
    .map(flatSum)
    .reduce((acc,val) => [[...acc[0],val]],[[]])
    .map(merge)[0];

    console.log(result)
Add Comment