-
Notifications
You must be signed in to change notification settings - Fork 2
/
1038.js
43 lines (36 loc) · 644 Bytes
/
1038.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const input = require("fs").readFileSync("./dev/stdin", "utf8");
let values = input.split(" ");
let valuesParse = values.map(function (x) {
return parseInt(x);
});
let [cod, qtd] = valuesParse;
let items = [
{
codigo: 1,
nome: "Cachorro Quente",
preco: 4.0,
},
{
codigo: 2,
nome: "X-Salada",
preco: 4.5,
},
{
codigo: 3,
nome: "X-Bacon",
preco: 5.0,
},
{
codigo: 4,
nome: "Torrada simples",
preco: 2.0,
},
{
codigo: 5,
nome: "Refrigerante",
preco: 1.5,
},
];
let i = cod - 1;
let total = qtd * items[i].preco;
console.log(`Total: R$ ${total.toFixed(2)}`);