TOPIC
90% wrong não consigo identificar o erro no código
Guilherme241 asked 3 years ago
A saída está exatamente IGUAL como está sendo pedido
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');
var codigo = lines.shift();
var quantidade = lines.shift();
function tabela(){
switch(codigo){
case 1: console.log(`Total: R$ ${(4.00*quantidade).toFixed(2)}`);
break;
case 2: console.log(`Total: R$ ${(4.50*quantidade).toFixed(2)}`);
break;
case 3: console.log(`Total: R$ ${(5.00*quantidade).toFixed(2)}`);
break;
case 4: console.log(`Total: R$ ${(2.00*quantidade).toFixed(2)}`);
break;
case 5: console.log(`Total: R$ ${(1.50*quantidade).toFixed(2)}`);
break;
default: console.log("Código inexistente");
}
}
tabela();