Advertisement
silvana1303

shopping

Apr 28th, 2020
675
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.05 KB | None | 0 0
  1. using System;
  2.  
  3. namespace exampreparation
  4.  
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             double budget = double.Parse(Console.ReadLine());
  11.             int videoCard = int.Parse(Console.ReadLine());
  12.             int processor = int.Parse(Console.ReadLine());
  13.             int ramMemory = int.Parse(Console.ReadLine());
  14.  
  15.             int videoCardPrice = videoCard * 250;
  16.             double processorPrice = (videoCardPrice * 0.35) * processor;
  17.             double ramMemoryPrice = (videoCardPrice * 0.10) * ramMemory;
  18.  
  19.             double fullSum = videoCardPrice + processorPrice + ramMemoryPrice;
  20.  
  21.             if (videoCard > processor)
  22.             {
  23.                 fullSum *= 0.85;
  24.             }
  25.  
  26.             if (fullSum <= budget)
  27.             {
  28.                 Console.WriteLine($"You have {budget - fullSum:f2} leva left!");
  29.             }
  30.             else
  31.             {
  32.                 Console.WriteLine($"Not enough money! You need {fullSum - budget:f2} leva more!");
  33.             }
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement