Advertisement
dragonbs

07. Shopping

Sep 18th, 2022
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.50 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 budget = double.Parse(Console.ReadLine());
  10.             int countOfVideoCards = int.Parse(Console.ReadLine());
  11.             int CountOfProcessor = int.Parse(Console.ReadLine());
  12.             int countOfRamMemory = int.Parse(Console.ReadLine());
  13.  
  14.             double priceForVideoCard = 250;
  15.             double sumVideoCards = countOfVideoCards * priceForVideoCard;
  16.  
  17.             double pricePerProcessor = sumVideoCards * 0.35;
  18.             double sumProcessor = CountOfProcessor * pricePerProcessor;
  19.  
  20.             double pricePerRam = sumVideoCards * 0.10;
  21.             double sumRam = pricePerRam * countOfRamMemory;
  22.  
  23.             double fullPrice = sumProcessor + sumRam + sumVideoCards;
  24.  
  25.             if (countOfVideoCards > CountOfProcessor)
  26.             {
  27.                 fullPrice = fullPrice - (fullPrice * 0.15);
  28.             }
  29.             else
  30.             {
  31.                 fullPrice = sumProcessor + sumRam + sumVideoCards;
  32.             }
  33.  
  34.             if (budget >= fullPrice)
  35.             {
  36.                 double moneyLeft = budget - fullPrice;
  37.                 Console.WriteLine($"You have {moneyLeft:f2} leva left!");
  38.             }
  39.             else
  40.             {
  41.                 double moneyNeeded = fullPrice - budget;
  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