saimun1

[TEST EXAM] 01.Alchohol market

Jul 26th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.97 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Practicing
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.             var whiskeyPrice = double.Parse(Console.ReadLine());
  15.             var beer = double.Parse(Console.ReadLine());
  16.             var wine = double.Parse(Console.ReadLine());
  17.             var rakia = double.Parse(Console.ReadLine());
  18.             var whiskey = double.Parse(Console.ReadLine());
  19.  
  20.             double rakiaPrice = whiskeyPrice / 2;
  21.             double winePrice = 0.6 * rakiaPrice; winePrice *= wine;
  22.             double beerPrice = 0.2 * rakiaPrice; beerPrice *= beer;
  23.             whiskeyPrice *= whiskey;
  24.             rakiaPrice *= rakia;
  25.  
  26.             double price = rakiaPrice +
  27.                 winePrice + beerPrice + whiskeyPrice;
  28.             Console.WriteLine($"{price:f2}");
  29.             Console.ReadLine();
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment