Please code the following using C Consider the following sce

Please code the following using C#

Consider the following scenario; a landscape service has hired you to create a new tracking system. They have 2 types or appointments; morning and afternoon. There are 5 appointments for morning and 5 for afternoon. using an array, create a C # application tart prompts the user for the appointment type (morning or afternoon) then reserves a slot of that type. The first 5 array slots are morning and the second 5 slots are afternoon. If there is no appointment of that type available, show a message telling the user that there is no appointment available? Your screenshot must show the appointment type request and the Slot # assigned. Your application must test using the test cases shown below. Run all of the test cases in ore execution of your application. Include the test prompts in your screenshot. At the beginning of your program, display your name and the assignment due date. 1 Afternoon 2 Morning 3 Afternoon 4 Afternoon 5 Afternoon 6 Afternoon 7 Afternoon 8 Morning

Solution

// C# code
using System.IO;
using System;

class Program
{
static void Main()
{
int [] reservation = new int[11];
int i = 1, j = 1, k;

for ( k = 1; k <= 10; k++ )
{
reservation[k] = 0;
}

while(true)
{
Console.WriteLine(\"Enter reservation type(Morning/Afternoon/Quit): \"); // Prompt
string type = Console.ReadLine();
if(type == \"Morning\")
{
if(i == 6)
{
Console.WriteLine(\"There is no appointment available for this type\ \");
}
  
else
{
// reserve the appointment
reservation[i] = 1;
Console.WriteLine(\"Morning Slot#{0}\ \",i);
i = i + 1;
  
}
}
  
else if(type == \"Afternoon\")
{
if(j == 6)
{
Console.WriteLine(\"There is no appointment available for this type\ \");
}
  
else
{
// reserve the appointment
reservation[j+5] = 1;
Console.WriteLine(\"Afternoon Slot#{0}\ \",j);
j = j + 1;
  
}
}
  
else if(type == \"Quit\")
{
break;
}
  
else
{
Console.WriteLine(\"Invalid Input type\ \");
}
  
}
  
}
}

/*
output:

Enter reservation type(Morning/Afternoon/Quit):
Afternoon
Afternoon Slot#1   

Enter reservation type(Morning/Afternoon/Quit):
Morning
Morning Slot#1   

Enter reservation type(Morning/Afternoon/Quit):
Afternoon
Afternoon Slot#2   

Enter reservation type(Morning/Afternoon/Quit):
Afternoon
Afternoon Slot#3

Enter reservation type(Morning/Afternoon/Quit):
Afternoon
Afternoon Slot#4

Enter reservation type(Morning/Afternoon/Quit):
Afternoon
Afternoon Slot#5   

Enter reservation type(Morning/Afternoon/Quit):
Afternoon
There is no appointment available for this type

Enter reservation type(Morning/Afternoon/Quit):
Morning
Morning Slot#2   

Enter reservation type(Morning/Afternoon/Quit):
Quit

*/

Please code the following using C# Consider the following scenario; a landscape service has hired you to create a new tracking system. They have 2 types or appo
Please code the following using C# Consider the following scenario; a landscape service has hired you to create a new tracking system. They have 2 types or appo

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site