Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _07.AlcoholMarket
- {
- class Program
- {
- static void Main(string[] args)
- {
- //сума за ракия = количество ракия * единична цена за ракия (единича цена за уиски / 2) OK
- //сума за бира = количество бира * единична цена за бира (цена на ракията - 0.8 * цена на ракията) OK
- //сума за вино = количество вино * единична цена за вино (цена на ракията - 0.4 * цена на ракията) OK
- //сума за уиски = количество уиски * единича цена за уиски OK
- //обща сума = сума за бира + сума за вино + сума за уиски + сума за ракия
- double whiskeyPrice = double.Parse(Console.ReadLine());
- double beerQuantity = double.Parse(Console.ReadLine());
- double wineQuantity = double.Parse(Console.ReadLine());
- double rakiaQuantity = double.Parse(Console.ReadLine());
- double whiskeyQuantity = double.Parse(Console.ReadLine());
- double rakiaPrice = whiskeyPrice / 2;
- double sumRakia = rakiaQuantity * rakiaPrice;
- double beerPrice = rakiaPrice - 0.8 * rakiaPrice; //0.2 * rakiaPrice
- double sumBeer = beerQuantity * beerPrice;
- double winePrice = rakiaPrice - 0.4 * rakiaPrice; //0.6 * rakiaPrice
- double sumWine = wineQuantity * winePrice;
- double sumWhiskey = whiskeyQuantity * whiskeyPrice;
- double totalSum = sumBeer + sumWine + sumRakia + sumWhiskey;
- Console.WriteLine($"{totalSum:F2}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement