Facebook
From Crimson Parakeet, 1 Year ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 90
  1. using System;
  2.  
  3. namespace _03_NewHouse
  4. {
  5.     internal class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             // 1.Read all input
  10.             // 2.Calculate total Costs
  11.             //Roses - 5 leva : if more than 80 -10% discount
  12.             //Dahlias - 3.8 : if more than 90 -15%
  13.             //tulips -2.8 if more than 80 - 15% discount
  14.             // narcissue - 3 of less than 120- add 15% to thr final price
  15.             // gladious - 2.5; if less than 80 - add 20% to thr finsl price
  16.             //"Hey, you have a great garden with {броя цвета} {вид цветя} and {останалата сума} leva left."
  17.  
  18. // Ако бюджета им е НЕ достатъчен -"Not enough money, you need {нужната сума} leva more.
  19.             string flowerType = Console.ReadLine();
  20.             int flowerCount = int.Parse(Console.ReadLine());
  21.             int budget = int .Parse(Console.ReadLine());
  22.             double totalCosts = 0;
  23.  
  24.             if (flowerType == "Roses")
  25.             {
  26.                 totalCosts = 5 * flowerCount;
  27.                 if (flowerCount > 80)
  28.                 {
  29.                     totalCosts = 0.9 * totalCosts;
  30.                 }
  31.             }
  32.             else if (flowerType == "Dahlias")
  33.             {
  34.                 totalCosts = 3.8 * flowerCount;
  35.                 if (flowerCount > 90)
  36.                 {
  37.                     totalCosts = 0.85 * totalCosts;
  38.                 }
  39.             }
  40.             else if (flowerType == "Tulips")
  41.             {
  42.                 totalCosts = 2.8 * flowerCount;
  43.                 if (flowerCount > 80)
  44.                 {
  45.                     totalCosts = 0.85 * totalCosts;
  46.                 }
  47.             }
  48.             else if (flowerType == "Narcissus")
  49.             {
  50.                 totalCosts = 3 * flowerCount;
  51.                 if (flowerCount < 120)
  52.                 {
  53.                     totalCosts = (0.15 * totalCosts) + totalCosts;
  54.                 }
  55.             }
  56.             else if (flowerType == "Glasious")
  57.             {
  58.                 totalCosts = 2.5 * flowerCount;
  59.                 if (flowerCount < 80)
  60.                 {
  61.                     totalCosts = (0.2 * totalCosts) + totalCosts;
  62.                 }
  63.             }
  64.             if (budget >= totalCosts)
  65.             {
  66.                 double remainingMoney = budget - totalCosts;
  67.                 Console.WriteLine($"Hey, you have a great garden with {flowerCount} {flowerType} and {remainingMoney:f2} leva left.");
  68.             }
  69.             else
  70.             {
  71.                 double requiredMoney = totalCosts - budget;
  72.                 Console.WriteLine($"Not enough money, you need {requiredMoney:f2} leva more.");
  73.             }
  74.         }
  75.  
  76.         }
  77.     }
  78.  
  79.