thegrudge

JoroTheFootballPlayer

Nov 13th, 2014
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.02 KB | None | 0 0
  1. using System;
  2. class JoroTheFootballPlayer
  3. {
  4.     static void Main()
  5.     {
  6.         int allWeekends = 52;
  7.  
  8.         // In this part we are receiving data is the year leap or not.
  9.         // Also we are checking the input to avoid mistakes.
  10.         /*
  11.             Here we use "Convert.ToChar" because the data that "Console.ReadLine()" give is in type string.
  12.             But we want ot check if the input data is the symbol T or F.
  13.             And symbols are in type char
  14.         */
  15.         char leapAns = Convert.ToChar(Console.ReadLine());
  16.         int leapExtraPlays = 0;
  17.         if (leapAns == 't' | leapAns == 'T')
  18.         {
  19.             leapExtraPlays = 3;
  20.         }
  21.         else
  22.         {
  23.             if (leapAns == 'f' | leapAns == 'F')
  24.             {
  25.                 leapExtraPlays = 0;
  26.             }
  27.             else
  28.             {
  29.                 Console.WriteLine(">>ERROR<< Incorrect input!");
  30.             }
  31.         }
  32.  
  33.         // Input the number of holidays in the year (which are not Saturday or Sunday).
  34.         /*
  35.             Here we use "Convert.ToInt32" because the data that "Console.ReadLine()" give is in type string.
  36.             But we want to get the number of the holidays as an integer.
  37.         */
  38.         int holidays = Convert.ToInt32(Console.ReadLine());  // The variable "holidays" is "p" in the terms of the task
  39.  
  40.         // Input of how many times Joro goes at his homtown.
  41.         /*
  42.             Here we use "Convert.ToInt32" because the data that "Console.ReadLine()" give is in type string.
  43.             But we want to get the number of the weekends that Joro goes in his hometown as an integer.
  44.         */
  45.         int homeWeekends = Convert.ToInt32(Console.ReadLine()); // The variable "homeWeekends" is "h" in the terms of the task.
  46.  
  47.         //Counting Part.
  48.         int output = (allWeekends - homeWeekends) * 2 / 3 + holidays / 2 + homeWeekends + leapExtraPlays;
  49.         //Console.WriteLine("Joro will play {0} time football", output);
  50.         Console.WriteLine(output);
  51.     }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment