SmallShop
Здравейте колеги, имам известни затруднения със тази задача. Даже да си призная работи във IDE , но във Judge ми дава гешка про компилацията.
function smallMarket(input) {
let city = input[0]
let product = input[1]
let quantity = Number(input[2])
let price = 0;
if (city == 'Sofia') {
if (product == 'coffee') {
price = quantity * 0.5;
console.log(price)
} else if (product == 'water') {
price = quantity * 0.8;
console.log(price)
} else if (product == "beer"){
price = quantity * 1.2;
console.log(price)
} else if (product == 'sweets') {
price = quantity * 1.45;
console.log(price)
} else if (product == 'peanuts') {
price = quantity * 1.6;
console.log(price)
}
}
if (city == 'Varna') {
if (product == 'coffee') {
price = quantity * 0.45;
console.log(price)
} else if (product == 'water') {
price = quantity * 0.7;
console.log(price)
} else if (product == 'beer') {
price = quantity * 1.1;
console.log(price)
} else if (product == 'sweets') {
price = quantity * 1.35;
console.log(price)
} else if (product == 'peanuts') {
price = quantity * 1.55;
console.log(price)
}
}
if (city == 'Plovdiv') {
price = quantity * 0.4;
console.log(price)
} else if (product == 'water') {
price = quantity * 0.7;
console.log(price)
} else if (product == "beer") {
price = quantity * 1.15;
console.log(price)
} else if (product == 'sweets') {
price = quantity * 1.3;
console.log(price)
} else if (product == 'peanuts') {
price = quantity * 1.5;
console.log(price)
}
}
}
Беше ми от полза благодаря!