Good morning,
I hope I am asking this correctly per guidelines. I am taking a course and am stuck on exercise 6. I was given limited information but have to solve this code.
My task is -
Rocket Cars wants you to create a function to calculate how many weeks it would take to sell all their cars. Your function contains 2 parameters:
The average number of cars sold per day
The number of cars currently in the dealership
Your function must be named 'SalesCalculator' and has to return a number which represents the amount of weeks it would take to sell all their cars.
To do so: divide the number of cars in the dealership by the average number of cars sold per day Multiplied by 5. Your function must return the result of this equation.
I was given this code to start with -
function SalesCalculator(amountOfCars, averageSoldPerDay) {
return //code goes here
}
I have tried a bunch of ways but keep coming back with multiple different errors depending on what coding I try.
I have tried-
function SalesCalculator(amountOfCars, averageSoldPerDay) {
return (amountOfCars / averageSoldPerDay) * 5;
}
function SalesCalculator(amountOfCars, averageSoldPerDay) {
let amountOfCars = a;
let averageSoldPerDay = b;
return a / b * 5;
}
function SalesCalculator(amountOfCars, averageSoldPerDay) {
console.log(a / b * 5);
}
None of these have been accepted and I have tried a thousand different ways but so far I seem to be wrong.
Any help would be greatly appreciated I have been trying to figure this out for a couple of days.
Thanks!