Advertisement
Dianov

Conditional Statements Advanced - Lab (07. Working Hours)

Nov 1st, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.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. namespace WorkingHours
  8. {
  9.     class Program
  10.     {
  11.         public static void Main()
  12.         {
  13.             int hour = int.Parse(Console.ReadLine());
  14.             string weekDay = Console.ReadLine();
  15.  
  16.             if (weekDay == "Monday")
  17.             {
  18.                 if (hour >= 10 && hour < 18)
  19.                 {
  20.                     Console.WriteLine("open");
  21.                 }
  22.                 else if (hour < 10)
  23.                 {
  24.                     Console.WriteLine("closed");
  25.                 }
  26.                 else if (hour > 18)
  27.                 {
  28.                     Console.WriteLine("closed");
  29.                 }
  30.             }
  31.             else if (weekDay == "Tuesday")
  32.             {
  33.                 if (hour >= 10 && hour < 18)
  34.                 {
  35.                     Console.WriteLine("open");
  36.                 }
  37.                 else if (hour < 10)
  38.                 {
  39.                     Console.WriteLine("closed");
  40.                 }
  41.                 else if (hour > 18)
  42.                 {
  43.                     Console.WriteLine("closed");
  44.                 }
  45.             }
  46.             else if (weekDay == "Wednesday")
  47.             {
  48.                 if (hour >= 10 && hour < 18)
  49.                 {
  50.                     Console.WriteLine("open");
  51.                 }
  52.                 else if (hour < 10)
  53.                 {
  54.                     Console.WriteLine("closed");
  55.                 }
  56.                 else if (hour > 18)
  57.                 {
  58.                     Console.WriteLine("closed");
  59.                 }
  60.             }
  61.             else if (weekDay == "Thursday")
  62.             {
  63.                 if (hour >= 10 && hour < 18)
  64.                 {
  65.                     Console.WriteLine("open");
  66.                 }
  67.                 else if (hour < 10)
  68.                 {
  69.                     Console.WriteLine("closed");
  70.                 }
  71.                 else if (hour > 18)
  72.                 {
  73.                     Console.WriteLine("closed");
  74.                 }
  75.             }
  76.             else if (weekDay == "Friday")
  77.             {
  78.                 if (hour >= 10 && hour < 18)
  79.                 {
  80.                     Console.WriteLine("open");
  81.                 }
  82.                 else if (hour < 10)
  83.                 {
  84.                     Console.WriteLine("closed");
  85.                 }
  86.                 else if (hour > 18)
  87.                 {
  88.                     Console.WriteLine("closed");
  89.                 }
  90.             }
  91.             else if (weekDay == "Saturday")
  92.             {
  93.                 if (hour >= 10 && hour < 18)
  94.                 {
  95.                     Console.WriteLine("open");
  96.                 }
  97.                 else if (hour < 10)
  98.                 {
  99.                     Console.WriteLine("closed");
  100.                 }
  101.                 else if (hour > 18)
  102.                 {
  103.                     Console.WriteLine("closed");
  104.                 }
  105.             }
  106.             else if (weekDay == "Sunday")
  107.             {
  108.                     Console.WriteLine("closed");
  109.             }
  110.         }
  111.     }
  112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement