Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function footballSouvenirs(input) {
- let country = input[0];
- let souvenir = input[1];
- let volume = Number(input[2]);
- let print = "";
- let sum = 0;
- if (country === "Argentina") {
- if (souvenir === "flags") {
- sum = 3.25;
- } else if (souvenir === "caps") {
- sum = 7.20;
- } else if (souvenir === "posters") {
- sum = 5.10;
- } else if (souvenir === "stickers") {
- sum = 1.25;
- } else {
- print = "Invalid stock!";
- }
- } else if (country === "Brazil") {
- if (souvenir === "flags") {
- sum = 4.20;
- } else if (souvenir === "caps") {
- sum = 8.50;
- } else if (souvenir === "posters") {
- sum = 5.35;
- } else if (souvenir === "stickers") {
- sum = 1.20;
- } else {
- print = "Invalid stock!";
- }
- } else if (country === "Croatia") {
- if (souvenir === "flags") {
- sum = 2.75;
- } else if (souvenir === "caps") {
- sum = 6.90;
- } else if (souvenir === "posters") {
- sum = 4.95;
- } else if (souvenir === "stickers") {
- sum = 1.10;
- } else {
- print = "Invalid stock!";
- }
- } else if (country === "Denmark") {
- if (souvenir === "flags") {
- sum = 3.10;
- } else if (souvenir === "caps") {
- sum = 6.50;
- } else if (souvenir === "posters") {
- sum = 4.80;
- } else if (souvenir === "stickers") {
- sum = 0.90;
- } else {
- print = "Invalid stock!";
- }
- } else {
- print = "Invalid country!";
- }
- if (sum > 0) {
- console.log(`Pepi bought ${volume} ${souvenir} of ${country} for ${(sum * volume).toFixed(2)} lv.`);
- } else {
- console.log(print);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement