Advertisement
Guest User

Summer Shopping

a guest
Feb 22nd, 2020
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.95 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ExamPreparation._02.Summer_Shopping
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int budget = int.Parse(Console.ReadLine());
  10.             double summerTowel = double.Parse(Console.ReadLine());
  11.             int percent = int.Parse(Console.ReadLine());
  12.  
  13.             double umbrella = summerTowel * 2 / 3;
  14.             double flipFlops = 0.75 * umbrella;
  15.             double bag = (flipFlops + summerTowel) * 1 / 3;
  16.  
  17.             double finalSum = (umbrella + summerTowel + flipFlops + bag) - ((umbrella + summerTowel + flipFlops + bag) * ((double)percent / 100));
  18.  
  19.             if (finalSum <= budget)
  20.                 Console.WriteLine($"Annie's sum is {finalSum:f2} lv. She has {budget - finalSum:f2} lv. left.");
  21.             else if (finalSum > budget)
  22.                 Console.WriteLine($"Annie's sum is {finalSum:f2} lv. She needs {finalSum - budget:f2} lv. more.");
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement