Advertisement
simeon_stoykov

Problem 1 - Budget

Nov 10th, 2014
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.13 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. class Problem1
  8. {
  9.     static void Main()
  10.     {
  11.         int amountOfMoneyAvailable = int.Parse(Console.ReadLine());
  12.         int weekDaysOut = int.Parse(Console.ReadLine());
  13.         int hometownWeekends = int.Parse(Console.ReadLine());
  14.  
  15.         int normalWeekends = 4 - hometownWeekends;
  16.         int normalWeekendDaysExpenses = normalWeekends * 2 * 20;
  17.         int goingOutExpenses = weekDaysOut * ((int)(0.03 * amountOfMoneyAvailable) + 10);
  18.         int normalWeekDays = 22 - weekDaysOut;
  19.         int normalWeekDaysExpenses = normalWeekDays * 10;
  20.  
  21.         int moneyLeft = amountOfMoneyAvailable - normalWeekendDaysExpenses - goingOutExpenses - normalWeekDaysExpenses - 150;
  22.  
  23.         if (moneyLeft == 0)
  24.         {
  25.             Console.WriteLine("Exact Budget.");
  26.         }
  27.         if (moneyLeft > 0)
  28.         {
  29.             Console.WriteLine("Yes, leftover {0}.", moneyLeft);
  30.         }
  31.         if (moneyLeft < 0)
  32.         {
  33.             Console.WriteLine("No, not enough {0}.", Math.Abs(moneyLeft));
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement