Здравейте,
Имам проблем с функцията .toFixed за output-а на тази задача (изписва 5.5 вместо 5.50 въпреки сложеният .toFixed(2);). Бихте ли могли да погледнете : )
let input = [
'31',
'115',
];
let print = this.print || console.log;
let gets = this.gets || ((arr, index) => () => arr[index++])(input, 0);
const txt = +gets();
const min = +gets();
const extraMin = min - 60;
const extraTxt = txt - 20;
let billExtraMin = 0;
let billExtraTxt = 0;
let taxMin = 0;
let taxTxt = 0;
if (txt < 20) {
print('0 additional messages for 0.00 levas');
} else {
billExtraTxt = +(extraTxt * 0.06).toFixed(2);
taxTxt = +billExtraTxt*0.2.toFixed(2);
print(`${extraTxt} additional messages for ${billExtraTxt} levas`);
}
if (min < 60 ) {
print('0 additional minutes for 0.00 levas');
} else {
billExtraMin = +(extraMin * 0.1).toFixed(2);
taxMin = +billExtraMin*0.2.toFixed(2);
print(`${extraMin} additional minutes for ${billExtraMin} levas`);
}
const totalTax = +(taxMin + taxTxt).toFixed(2);
print(${totalTax} additional taxes
);
const totalBill = +(12 + billExtraMin + billExtraTxt + totalTax).toFixed(2);
print(${totalBill} total bill
);