0

Store Manager Code

You are working on a Store Manager program, which stores the prices in an array. You need to add functionality to increase the prices by the given amount. The increase variable is taken from user input. You need to increase all the prices in the given array by that amount and output to the console the resulting array. My code runs but I’m not sure where to go after this? I’m confused on how to iterate over the array and then add to imputed amount. https://code.sololearn.com/W6p47HQ33pGw/?ref=app

14th Apr 2022, 12:49 PM
Quality Crew
Quality Crew - avatar
1 ответ
+ 1
function main() { var increase = parseInt(readLine(), 10); var prices = [98.99, 15.2, 20, 1026]; //your code goes for(i=0;i<prices.length;i++) prices[i] = price[i] + increase; //increse every element by 'increse' value console.log(prices); //print array }; main() // prince.length return the array length // price[I] access element at index I in price array.. // Hope it helps..
14th Apr 2022, 12:55 PM
Jayakrishna 🇮🇳