Advertisement
desislava_topuzakova

07.AlcoholMarket

Feb 9th, 2020
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.87 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _07._AlcoholMarket
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.  
  10.             double whiskeyPrice = double.Parse(Console.ReadLine());
  11.             double beerLiters = double.Parse(Console.ReadLine());
  12.             double wineLiters = double.Parse(Console.ReadLine());
  13.             double rakiaLiters = double.Parse(Console.ReadLine());
  14.             double whiskeyLiters = double.Parse(Console.ReadLine());
  15.  
  16.             double rakiaPrice = whiskeyPrice / 2;
  17.             double winePrice = rakiaPrice - 0.4 * rakiaPrice;
  18.             double beerPrice = rakiaPrice - 0.8 * rakiaPrice;
  19.  
  20.             double totalPrice = (rakiaPrice * rakiaLiters) + (winePrice * wineLiters) +
  21.                 (whiskeyPrice * whiskeyLiters) + (beerLiters * beerPrice);
  22.  
  23.             Console.WriteLine($"{totalPrice:F2}");
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement