Advertisement
Atanasov_88

TravellerTom

Jul 11th, 2015
522
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.18 KB | None | 0 0
  1. using System;
  2.  
  3.     class TravellerBob
  4.     {
  5.         static void Main()
  6.         {
  7.             string leapYear = Console.ReadLine();
  8.             int contractMonths = int.Parse(Console.ReadLine());
  9.             int familyMonths = int.Parse(Console.ReadLine());
  10.  
  11.              double year = 12;
  12.              double monthWeeks = 4;
  13.  
  14.             double normalMonths = year - (contractMonths+familyMonths); // 12 - 3 = 9
  15.            
  16.             double contractMonthSum = (contractMonths*monthWeeks)*3; // 2*4*3 = 24
  17.  
  18.             double familyMonthSum = (familyMonths * 2) * 2; // 2*2 = 4
  19.  
  20.             double normalDaySum = ((normalMonths*12)*3)/5; //9*12*3/5 = 64.8
  21.  
  22.             double allSum = normalDaySum + familyMonthSum + contractMonthSum; // 64.8 + 4 + 24 = 92.8
  23.  
  24.             if (leapYear == "leap")
  25.             {
  26.                 allSum = allSum + (allSum * 5 / 100); // 92.8 + 4.64 = 97.44
  27.                 Console.WriteLine(Math.Floor(allSum));
  28.             }
  29.             if (leapYear == "normal")
  30.             {
  31.                 Console.WriteLine(Math.Floor(allSum)); //92.8 = 92
  32.             }
  33.  
  34.            
  35.            
  36.            
  37.            
  38.         }
  39.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement