Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main()
- {
- int budget = int.Parse(Console.ReadLine());
- double beachTowelPrice = double.Parse(Console.ReadLine());
- int discount = int.Parse(Console.ReadLine());
- // 2. Calculate the prices of all items
- double umbrellaPrice = 2.0 / 3 * beachTowelPrice;
- double flipFlopsPrice = 0.75 * umbrellaPrice;
- double bagPrice = 1.0 / 3 * (beachTowelPrice + flipFlopsPrice);
- // 3. Calculate the total bill
- double total = beachTowelPrice + umbrellaPrice + flipFlopsPrice + bagPrice;
- // 4. Discount
- total -= discount / 100.00 * total;
- // 5. Check if the money she has is enough
- if (budget >= total)
- {
- Console.WriteLine($"Annie's sum is {total:f2} lv. She has {budget-total:f2} lv. left.");
- }
- else
- {
- Console.WriteLine($"Annie's sum is {total:f2} lv. She needs {total - budget:f2} lv. more.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement