Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Lab3
- {
- class Appointments
- {
- private static object afternoon;
- private static int alength;
- private static int mlength;
- private static object morning;
- static void Main(string[] args)
- {
- Console.WriteLine("Name Here");
- Console.WriteLine("Due Date Here");
- int[] app = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
- bool flag = false;
- while (flag == false)
- {
- Console.WriteLine("Would you like to schedule an appointment? y for yes, n for no");
- String choice = Console.ReadLine();
- if (choice.Equals("y"))
- {
- while (choice.Equals("y"))
- {
- Console.WriteLine("Enter your preferred time slot: Morning or Afternoon");
- String timechoice = Console.ReadLine();
- if (timechoice.Equals("Morning".Trim()) || timechoice.Equals("morning".Trim()))
- {
- if (mlength == 0)
- {
- Console.WriteLine("No morning slots available");
- break;
- }
- else
- {
- mlength = mlength - 1;
- Console.WriteLine("success");
- }
- }
- else if (timechoice.Equals("Afternoon".Trim()) || timechoice.Equals("afternoon".Trim()))
- {
- if (alength == 0)
- {
- Console.WriteLine("No afternoon slots available");
- break;
- }
- else
- {
- alength = alength - 1;
- Console.WriteLine("Afternoon time slot booked!");
- }
- }
- Console.WriteLine("Would you like to schedule an appointment? y for yes, n for no");
- choice = Console.ReadLine();
- }
- }
- else
- {
- Console.WriteLine("You didn't choose any time slots. Thanks for visiting.");
- }
- Console.WriteLine("The morning slots that are available are {0}", mlength);
- Console.WriteLine("The afternoon slots that are available are {0}", alength);
- Console.ReadKey();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement