Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _02.Shopping
- {
- class Program
- {
- static void Main(string[] args)
- {
- //ВИДЕО КАРТА -> ЕД.ЦЕНА И БРОЙ - > ЦЕНА ЗА В.К = БРОЙ * ЕД.ЦЕНА
- //ПРОЦЕСОРИ -> ЕД.ЦЕНА(?) И БРОЙ -> ЦЕНА ЗА ПРОЦ = БРОЙ * ЕД.ЦЕНА
- //РАМ -> ЕД. ЦЕНА(?) И БРОЙ -> ЦЕНА ЗА РАМ = БРОЙ * ЕД.ЦЕНА
- //СМЕТКА = ЦЕНА ЗА В.К + ЦЕНА ЗА ПРОЦ. + ЦЕНА ЗА РАМ
- //ПРОВЕРКА ЗА ОТСТЪПКА
- //ПРОВЕРКА ДАЛИ БЮДЖЕТЪТ ПОКРИВА СМЕТКАТА
- //1. ВХОД
- //2. ЕД.ЦЕНА ЗА ПРОЦЕСОРА
- //3. ЕД ЦЕНА ЗА РАМ
- //4. ОБЩАТА СМЕТКА
- //5. ОТСТЪПКА
- //6. ПРОВЕРКА ЗА БЮДЖЕТА
- double budget = double.Parse(Console.ReadLine());
- int countVideoCards = int.Parse(Console.ReadLine());
- int countProc = int.Parse(Console.ReadLine());
- int countRAM = int.Parse(Console.ReadLine());
- double priceVideoCards = 250 * countVideoCards;
- double pricePerProcessor = 0.35 * priceVideoCards;
- double priceProcessors = countProc * pricePerProcessor;
- double pricePerRAM = 0.1 * priceVideoCards;
- double priceRAMs = pricePerRAM * countRAM;
- double total = priceVideoCards + priceProcessors + priceRAMs;
- if(countVideoCards > countProc)
- {
- total = total - 0.15 * total;
- }
- //крайна сметка
- if(budget >= total)
- {
- //достатъчен
- double left = budget - total;
- Console.WriteLine($"You have {left:F2} leva left!");
- }
- else
- {
- //не е достатъчен
- double need = total - budget;
- Console.WriteLine($"Not enough money! You need {need:F2} leva more!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment