Advertisement
nevenailievaa

07.Shopping

Oct 13th, 2022
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.18 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.             //Input
  10.             double budget = double.Parse(Console.ReadLine());
  11.             int numberVideoCards = int.Parse(Console.ReadLine());
  12.             int numberProcessors = int.Parse(Console.ReadLine());
  13.             int numberMemories = int.Parse(Console.ReadLine());
  14.  
  15.             //Prices
  16.             double videoCardsPrice = numberVideoCards * 250;
  17.             double processorsPrice = numberProcessors * (0.35 * videoCardsPrice);
  18.             double memoriesPrice = numberMemories * (0.10 * videoCardsPrice);
  19.  
  20.             //Action
  21.             double bill = videoCardsPrice + processorsPrice + memoriesPrice;
  22.  
  23.             if (numberVideoCards > numberProcessors)
  24.             {
  25.                 bill = bill - (bill * 0.15);
  26.             }
  27.             if (budget >= bill)
  28.             {
  29.                 Console.WriteLine($"You have {(budget - bill):f2} leva left!");
  30.             }
  31.             else
  32.             {
  33.                 Console.WriteLine($"Not enough money! You need {(bill - budget):f2} leva more!");
  34.             }
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement