Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.89 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 Lab3
  8. {
  9. class Appointments
  10. {
  11. private static object afternoon;
  12. private static int alength;
  13. private static int mlength;
  14. private static object morning;
  15.  
  16. static void Main(string[] args)
  17. {
  18. Console.WriteLine("Name Here");
  19.  
  20. Console.WriteLine("Due Date Here");
  21.  
  22. int[] app = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
  23.  
  24. bool flag = false;
  25.  
  26. while (flag == false)
  27.  
  28. {
  29.  
  30. Console.WriteLine("Would you like to schedule an appointment? y for yes, n for no");
  31.  
  32. String choice = Console.ReadLine();
  33.  
  34.  
  35. if (choice.Equals("y"))
  36. {
  37. while (choice.Equals("y"))
  38. {
  39. Console.WriteLine("Enter your preferred time slot: Morning or Afternoon");
  40. String timechoice = Console.ReadLine();
  41. if (timechoice.Equals("Morning".Trim()) || timechoice.Equals("morning".Trim()))
  42. {
  43. if (mlength == 0)
  44. {
  45. Console.WriteLine("No morning slots available");
  46. break;
  47. }
  48. else
  49. {
  50.  
  51. mlength = mlength - 1;
  52. Console.WriteLine("success");
  53. }
  54.  
  55. }
  56. else if (timechoice.Equals("Afternoon".Trim()) || timechoice.Equals("afternoon".Trim()))
  57. {
  58. if (alength == 0)
  59. {
  60. Console.WriteLine("No afternoon slots available");
  61. break;
  62. }
  63. else
  64. {
  65. alength = alength - 1;
  66. Console.WriteLine("Afternoon time slot booked!");
  67. }
  68.  
  69. }
  70.  
  71. Console.WriteLine("Would you like to schedule an appointment? y for yes, n for no");
  72. choice = Console.ReadLine();
  73.  
  74. }
  75. }
  76. else
  77. {
  78. Console.WriteLine("You didn't choose any time slots. Thanks for visiting.");
  79. }
  80.  
  81. Console.WriteLine("The morning slots that are available are {0}", mlength);
  82. Console.WriteLine("The afternoon slots that are available are {0}", alength);
  83. Console.ReadKey();
  84. }
  85. }
  86. }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement