Advertisement
madeofglass

Untitled

Feb 27th, 2020
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.15 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _02.Shopping
  4. {
  5.     class Shopping
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double budget = double.Parse(Console.ReadLine());
  10.             double numVideoCards = double.Parse(Console.ReadLine());
  11.             double numProcessors = double.Parse(Console.ReadLine());
  12.             double numRamMemory = double.Parse(Console.ReadLine());
  13.  
  14.             double priceVideoCards = numVideoCards * 250.0;
  15.             double priceProcessor = numProcessors * (priceVideoCards * 0.35);
  16.             double priceRamMemory = numRamMemory * (priceVideoCards * 0.10);
  17.  
  18.             double all = priceVideoCards + priceProcessor + priceRamMemory;
  19.  
  20.             if (numVideoCards > numProcessors)
  21.             {
  22.                 all = all * 0.85;
  23.             }
  24.  
  25.             double difference = Math.Abs(budget - all);
  26.  
  27.             if (budget >= all)
  28.             {
  29.                 Console.WriteLine($"You have {difference:f2} leva left!");
  30.             }
  31.             else
  32.             {
  33.                 Console.WriteLine($"Not enough money! You need {difference:f2} leva more!");
  34.             }
  35.  
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement