Instantly share code, notes, and snippets.

Embed
What would you like to do?
Homework 1.5 created by Ulvac - https://repl.it/@Ulvac/Homework-15
'use strict'
// 1
var price;
var taxes = 0;
function update_taxes(offerPrice) {
let taxe = 0.73 * offerPrice;
taxes += taxe;
return console.log(`Налог с продажи 73 % к оплате ${taxes} Q`)
};
update_taxes(100);
update_taxes(200);
update_taxes(300);
// 2
var wrappingPaper = 30 ;
function packaging(a, b, c) {
let area_box = 2 * (a * b + b * c + a * c);
wrappingPaper -= area_box;
if (wrappingPaper >= 0) {
return console.log(`Заказ ${a, b, c} упакован, осталось упаковочной бумаги ${wrappingPaper} м2`)
}
else {
return console.log(`Заказ ${a, b, c} не упакован, осталось упаковочной бумаги ${wrappingPaper} м2`)
}
};
packaging(1, 1, 1);
packaging(2, 2, 2);
packaging(5, 5, 5);
// 3
var chargeTeleport = [7, 2, 1, 4, 8];
var chargeInfo = [use_teleport(0), use_teleport(0), use_teleport(2), use_teleport(2)];
function use_teleport(teleport) {
if (chargeTeleport[teleport] === 0) {
return console.log(`Телепорт ${teleport + 1} недоступен, заряжаеться`)
}
chargeTeleport[teleport]--;
if (chargeTeleport[teleport] === 0) {
return console.log(`Телепорт ${teleport + 1} использован, заряд - ${chargeTeleport[teleport]}, требуеться подзарядка`)
}
return console.log(`Телепорт ${teleport + 1} использован, заряд — ${chargeTeleport[teleport]} единиц`);
};
function check_charge() {
for (let num = 0; num < chargeTeleport.length; num++) {
console.log(`Телепорт ${num + 1}, заряд — ${chargeTeleport[num]} единиц`)
};
};
check_charge();
@UlvacMoscow

This comment has been minimized.

Show comment
Hide comment
@UlvacMoscow

UlvacMoscow Jun 13, 2018

homework 1.5

Owner

UlvacMoscow commented Jun 13, 2018

homework 1.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment