skipter icon

Fruit Coctail

skipter | PRO | 09/18/17 05:55:48 AM UTC | 0 ⭐ | 410 👁️ | Never ⏰ | []
C# |

1.97 KB

|

None

|

0 👍

/

0 👎

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace FriutCoctails
{
    class Program
    {
        static void Main(string[] args)
        {
            string fruit = Console.ReadLine();
            string bigOrSmall = Console.ReadLine();
            int drinksCount = int.Parse(Console.ReadLine());
 
            double watermelon = 0;
            double mango = 0;
            double pineapple = 0;
            double raspeberry = 0;
 
            if (bigOrSmall.Equals("small"))
            {
                watermelon = 56 * 2;
                mango = 36.66 * 2;
                pineapple = 42.10 * 2;
                raspeberry = 20 * 2;
            }
            else if (bigOrSmall == "big")
            {
                watermelon = 28.70 * 5;
                mango = 19.60 * 5;
                pineapple = 24.80 * 5;
                raspeberry = 15.20 * 5;
            }
            double fruitsPrice = 0;
            if (fruit.Equals("Watermelon"))
            {
                fruitsPrice = watermelon * drinksCount;
            }
            else if (fruit.Equals("Mango"))
            {
                fruitsPrice = mango * drinksCount;
            }
            else if (fruit.Equals("Pineapple"))
            {
                fruitsPrice = pineapple * drinksCount;
            }
            else if (fruit.Equals("Raspberry"))
            {
                fruitsPrice = raspeberry * drinksCount;
            }
            double fruitPriceDiscount = 0;
            if (fruitsPrice >= 400 && fruitsPrice <= 1000)
            {
                fruitPriceDiscount = fruitsPrice * 0.15;
            } else if (fruitsPrice > 1000)
            {
                fruitPriceDiscount = fruitsPrice * 0.50;
            }
            double totalPrice = fruitsPrice - fruitPriceDiscount;
            Console.WriteLine("{0:F2} lv.", totalPrice);
        }
    }
}

Comments