Advertisement
vencinachev

Cryptocurrency

Mar 16th, 2019
354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.13 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5. public class Program
  6. {
  7.     public static void Main()
  8.     {
  9.         double bitcoins = double.Parse(Console.ReadLine());
  10.         double etereums = double.Parse(Console.ReadLine());
  11.         double litecoins = double.Parse(Console.ReadLine());
  12.         int transactions = int.Parse(Console.ReadLine());
  13.         double money = 0;
  14.         double commision = 0;
  15.         double coeff = 0.073456764216789345;
  16.        
  17.         for (int i = 0; i < transactions; i++)
  18.         {
  19.             int actives = int.Parse(Console.ReadLine());
  20.             String valuta = Console.ReadLine();
  21.             String type = Console.ReadLine();
  22.             double operationMoney = 0;
  23.             if (valuta == "Bitcoin")
  24.             {
  25.                 operationMoney = actives * bitcoins;
  26.             }
  27.             else if (valuta == "Etereum")
  28.             {
  29.                 operationMoney = actives * etereums;
  30.             }
  31.             else if (valuta == "Litecoin")
  32.             {
  33.                 operationMoney = actives * litecoins;
  34.             }
  35.             if (type == "Sell")
  36.             {
  37.                 money -= operationMoney;
  38.             }
  39.             else if (type == "Buy")
  40.             {
  41.                 money += operationMoney;
  42.             }
  43.             commision += operationMoney * coeff;
  44.            
  45.         }
  46.         money -= commision;
  47.         Console.WriteLine("{0:F16}", money);
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement