Advertisement
dragonbs

Shopping

Oct 2nd, 2022
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.53 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _07.Shopping
  4. {
  5.     internal class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double budgett = double.Parse(Console.ReadLine());
  10.             int countOfVideoCardss = int.Parse(Console.ReadLine());
  11.             int CountOfProcessors = int.Parse(Console.ReadLine());
  12.             int countOfRamMemorys = int.Parse(Console.ReadLine());
  13.  
  14.             double priceForVideoCards = 250;
  15.             double sumVideoCardss = countOfVideoCardss * priceForVideoCards;
  16.  
  17.             double pricePerProcessors = sumVideoCardss * 0.35;
  18.             double sumProcessors = CountOfProcessors * pricePerProcessors;
  19.  
  20.             double pricePerRams = sumVideoCardss * 0.10;
  21.             double sumRams = pricePerRams * countOfRamMemorys;
  22.  
  23.             double fullPrice = sumProcessors + sumRams + sumVideoCardss;
  24.  
  25.             if (countOfVideoCardss > CountOfProcessors)
  26.             {
  27.                 fullPrice = fullPrice - (fullPrice * 0.15);
  28.             }
  29.             else
  30.             {
  31.                 fullPrice = sumProcessors + sumRams + sumVideoCardss;
  32.             }
  33.  
  34.             if (budgett >= fullPrice)
  35.             {
  36.                 double moneyLeft = budgett - fullPrice;
  37.                 Console.WriteLine($"You have {moneyLeft:f2} leva left!");
  38.             }
  39.             else
  40.             {
  41.                 double moneyNeeded = fullPrice - budgett;
  42.                 Console.WriteLine($"Not enough money! You need {moneyNeeded:f2} leva more!");
  43.             }
  44.         }
  45.     }
  46. }
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement