Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function shop(input) {
- let produkt = input.shift();
- let day = input.shift();
- let kolichestvo = Number(input.shift());
- if (day == 'Saturday' || day == 'Sunday') {
- if (produkt == 'banana') {
- console.log(kolichestvo * 2.70);
- } else if (produkt == 'apple') {
- console.log(kolichestvo * 1.25);
- } else if (produkt == 'orange') {
- console.log(kolichestvo * 0.9);
- } else if (produkt == 'grapefruit') {
- console.log(kolichestvo * 1.60);
- } else if (produkt == 'kiwi') {
- console.log(kolichestvo * 3);
- } else if (produkt == 'pineapple') {
- console.log(kolichestvo * 5.6);
- } else if (produkt == 'grapes') {
- console.log(kolichestvo * 4.2);
- } else {
- console.log("error")
- }
- } else if (day == 'Monday' || day == 'Tuesday' || day == 'Wednesday'
- || day == 'Thursday' || day == 'Friday') {
- if (produkt == 'banana') {
- console.log(kolichestvo * 2.50);
- } else if (produkt == 'apple') {
- console.log(kolichestvo * 1.20);
- } else if (produkt == 'orange') {
- console.log(kolichestvo * 0.85);
- } else if (produkt == 'grapefruit') {
- console.log(kolichestvo * 1.45);
- } else if (produkt == 'kiwi') {
- console.log(kolichestvo * 2.7);
- } else if (produkt == 'pineapple') {
- console.log(kolichestvo * 5.5);
- } else if (produkt == 'grapes') {
- console.log(kolichestvo * 3.85);
- } else {
- console.log("error")
- }
- } else {
- console.log("error")
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement