Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function mobileOperator(input) {
- let period = input[0];
- let type = input[1];
- let internet = input[2];
- let months = Number(input[3]);
- let tax = 0;
- if(type === "Small") {
- if(period === "one") {
- tax = months * 9.98
- } else {
- tax = months * 8.58;
- }
- if(internet === "yes") {
- tax += months * 5.50;
- }
- } else if(type === "Middle") {
- if(period === "one") {
- tax = months * 18.99
- } else {
- tax = months * 17.09;
- }
- if(internet === "yes") {
- tax += months * 4.35;
- }
- } else if(type === "Large") {
- if(period === "one") {
- tax = months * 25.98
- } else {
- tax = months * 23.59;
- }
- if(internet === "yes") {
- tax += months * 4.35;
- }
- } else if(type === "ExtraLarge") {
- if(period === "one") {
- tax = months * 35.99
- } else {
- tax = months * 31.79;
- }
- if(internet === "yes") {
- tax += months * 3.85;
- }
- }
- if(period === "two") {
- tax = tax - tax * 0.0375;
- }
- console.log(`${tax.toFixed(2)} lv.`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement