//sample solution
function calculateTotalCosts(salary, numWorkers, city){
var fixedCosts = 5000;
var variableCosts = salary * numWorkers;
switch(city){
case "NYC":
return fixedCosts + variableCosts + 30000;
case "BEJ":
return fixedCosts + variableCosts + 25000;
default:
return fixedCosts + variableCosts + 10000;
}
}
calculateTotalCosts(40000, 3, "BEJ");
function calculateTotalCosts(salary, numWorkers, city){
var fixedCosts = 5000;
var variableCosts = salary * numWorkers;
switch(city){
case "NYC":
return fixedCosts + variableCosts + 30000;
case "BEJ":
return fixedCosts + variableCosts + 25000;
default:
return fixedCosts + variableCosts + 10000;
}
}
calculateTotalCosts(40000, 3, "BEJ");
No comments:
Post a Comment