stoyanmkd

Budget

Dec 19th, 2014
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.03 KB | None | 0 0
  1. using System;
  2. class Program
  3. {
  4.     static void Main()
  5.     {
  6.         double money = double.Parse(Console.ReadLine());
  7.         int weekdayGoOut = int.Parse(Console.ReadLine());
  8.         int weekendHome = int.Parse(Console.ReadLine());
  9.         int rent = 150;
  10.         //
  11.         double weekDaysSum = 22 * 10;
  12.         double singleWeekDayOut = Math.Round(money * 0.03);
  13.         double WeekDayGoOutSum = weekdayGoOut * singleWeekDayOut;
  14.         double WeekendSum = (8 * 20) - (weekendHome * 20 *2);
  15.  
  16.         double allExpenses = rent + weekDaysSum + WeekDayGoOutSum + WeekendSum;
  17.  
  18.         if (money>allExpenses)
  19.         {
  20.             double left = money - allExpenses;
  21.             Console.WriteLine("Yes, leftover {0}.", left);
  22.         }
  23.         else if (money<allExpenses)
  24.         {
  25.             double notEnough = money - allExpenses;
  26.             Console.WriteLine("No, not enough {0}.", -notEnough);
  27.         }
  28.         else if (money == allExpenses)
  29.         {
  30.             Console.WriteLine("Exact Budget.");
  31.         }
  32.  
  33.  
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment