desislava_topuzakova

07. Fruit Market

May 9th, 2021
595
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace _07.FruitMarket
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.  
  10.  
  11.             double priceStrawberries = double.Parse(Console.ReadLine());
  12.             double kgBananas = double.Parse(Console.ReadLine());
  13.             double kgOranges = double.Parse(Console.ReadLine());
  14.             double kgRaspberries = double.Parse(Console.ReadLine());
  15.             double kgStrawberries = double.Parse(Console.ReadLine());
  16.  
  17.             //ягоди
  18.             double sumStrawberries = kgStrawberries * priceStrawberries;
  19.  
  20.             //малини
  21.             double priceRaspberries = priceStrawberries / 2;
  22.             double sumRaspberries = kgRaspberries * priceRaspberries;
  23.  
  24.             //банани
  25.             double priceBananas = priceRaspberries - 0.80 * priceRaspberries; // priceRaspberries * 0.2
  26.             double sumBananas = kgBananas * priceBananas;
  27.  
  28.             //портокали
  29.             double priceOranges = priceRaspberries - 0.40 * priceRaspberries; //0.6 * priceRaspberries
  30.             double sumOranges = kgOranges * priceOranges;
  31.  
  32.             //Обща сума
  33.             double totalSum = sumStrawberries + sumRaspberries + sumBananas + sumOranges;
  34.  
  35.             Console.WriteLine($"{totalSum:F2}");
  36.  
  37.  
  38.         }
  39.     }
  40. }
RAW Paste Data