Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Threading;
- using System.Globalization;
- class BeerTime
- {
- static void Main()
- {
- Console.WriteLine("Please enter the time, when you available for beer... :)");
- Console.Write("I'm available in ");
- try
- {
- DateTime userInput = DateTime.Parse(Console.ReadLine());
- DateTime beerTimeStart = Convert.ToDateTime("01:00 PM");
- DateTime beerTimeEnd = Convert.ToDateTime("03:00 AM").AddHours(24);
- if (userInput.Hour == 00 || userInput.Hour < 03)
- {
- userInput = userInput.AddDays(1);
- }
- bool beerTime = userInput >= beerTimeStart && userInput <= beerTimeEnd;
- if (beerTime)
- {
- Console.WriteLine("Its Beer Time...");
- Console.WriteLine("Now get a beer and come to TOAST!");
- }
- else
- {
- Console.WriteLine("Its not beer time yet.");
- Console.WriteLine("Try after {0:HH:mm} PM and before {1:HH:mm} AM", beerTimeStart, beerTimeEnd);
- }
- }
- catch
- {
- Console.WriteLine("I said enter the time you are available for drinking beer, not some bullshit.");
- Console.WriteLine("Probably you are drunk.. Go home to sleep and try later.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement