Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function logistics(input) {
- let contractYears = input.shift();
- let contractType = input.shift();
- let addedInternet = input.shift();
- let totalMonths = Number(input.shift());
- let monthTax = 0;
- let totalTax = 0;
- switch (contractType) {
- case "Small":
- if (contractYears == "one") {
- monthTax = 9.98;
- } else {
- monthTax = 8.58;
- } break;
- case "Middle":
- if (contractYears === "one") {
- monthTax = 18.99;
- } else {
- monthTax = 17.09;
- } break;
- case "Large":
- if (contractYears === "one") {
- monthTax = 25.98;
- } else {
- monthTax = 23.59;
- } break;
- case "ExtraLarge":
- if (contractYears === "one") {
- monthTax = 35.99;
- } else {
- monthTax = 31.79;
- } break;
- }
- if (addedInternet === "yes") {
- if (monthTax <= 10.00) {
- monthTax = monthTax + 5.50;
- } else if (monthTax > 10 && monthTax <= 30) {
- monthTax = monthTax + 4.35;
- } else {
- monthTax = monthTax + 3.85;
- }
- } else {
- monthTax = monthTax;
- }
- if (contractYears === "one") {
- totalMonthsTaxes = monthTax * totalMonths;
- } else {
- totalMonthsTaxes = monthTax * totalMonths * 0.9625;
- }
- console.log(`${totalMonthsTaxes.toFixed(2)} lv.`)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement