Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

ONLY USING VISUAL STUDIO Create a C# Console program that will demonstrate the u

ID: 3779684 • Letter: O

Question

ONLY USING VISUAL STUDIO

Create a C# Console program that will demonstrate the use of File IO, Arrays, and Classes. This assignment has a number of requirements. Carefully read the document and note all the requirements. Also keep in mind that many of the requirements for this assignment are module; that is if one requirement is not implemented, it will not affect another. For example, you can implement adding a seat without having removing a seat working. You can reserve and unreserve seats without having saving and loading working. To maximize your mark, try to complete as many requirements as possible, do not get stuck on one requirement and spend all of your time trying to get it to work at the neglect of other requirements.

1. Write a program that functions as a concert/restaurant/airplane/etc. reservation system. This system must be sufficiently complex, with a minimum of 4 rows with 4 seats in each row. You must display the seats on the screen in some manner and indicate which are available and which are taken, it is up to you to decide how to do this.

You may display the seating in any display format that you feel is appropriate as long as it logically conveys the information to the user. [4 Marks]

Example seating chart:

*************************************

*Seat 1-1*Seat 1-2*Seat 1-3*Seat 1-4*

*Seat 2-1*Seat 2-2*Seat 2-3*Seat 2-4*

*Seat 3-1*Seat 3-2*Seat 3-3*Seat 3-4*

*Seat 4-1*Seat 4-2*Seat 4-3*Seat 4-4*

*************************************

2. Allow the user the following options:

a. Add a customer to the seating plan [8 Marks]

i. Request the customer's name

ii. Display a list of the seats in the venue

iii. If seats are available, let the customer choose a seat. Add the customer to the seating chart on the application. For example, after adding a customer the seating chart would become:

*************************************

*Seat 1-1*Seat 1-2*Seat 1-3*S. Claus*

*Seat 2-1*Seat 2-2*Seat 2-3*Seat 2-4*

*Seat 3-1*Seat 3-2*Seat 3-3*Seat 3-4*

*Seat 4-1*Seat 4-2*Seat 4-3*Seat 4-4*

*************************************

iv. If no seats are available, inform the user

b. Remove a customer from the seating plan [4 Marks]

i. Request the customer's name or seat number

ii. Search the seating chart for the customer's name or seat number and delete it

3. Create a Seat class. Each seat in your seating chart should exist as its own object. The objects can then be stored in an array for ease of location. The implementation of the Seat class is left up to you in order to meet the requirements of your particular implementation. But some possible class variables that could be helpful: Where or not the seat has been purchased, the name of the purchaser, the name of the seat. Some possible helpful class methods: Reserve seat, unreserved seat, is the seat reserved. [4 Marks]

4. Your system should show validation whenever appropriate, and function in a logical manner. For example, the system should not shut down after each operation, if a user has to fix an entry the system should not start over, etc. [5 Marks]

5. Your system should also have File IO such that the reserved seats with who reserved them is not lost when your program shuts down.

Explanation / Answer

*****************************************Program*******************************************************

using System.IO;
using System;

class Seat
{
string[,] arr;
public Seat(String[,] temp){
arr=temp;
}
public void display(){
for(int i=0;i<4;i++){
   for(int j=0;j<4;j++){
   Console.Write(String.Format("{0} ",arr[i, j]));
   }
   Console.WriteLine();
   }
}
  
public void setData(){
string seat;
Console.WriteLine("Please enter which seat you want to choose:");
seat=Console.ReadLine();
int count=0;
for(int i=0;i<4;i++){
for(int j=0;j<4;j++){
if(arr[i,j]==seat){
Console.WriteLine("Please enter Your Name:");
string name=Console.ReadLine();
arr[i,j]=name;
display();
count=1;
}
  
}
}
if(count==0)
{
Console.WriteLine("Please Try again...!!!");
}
}
public void delData(){
string seat;
Console.WriteLine("Please enter your name to delete the seat:");
seat=Console.ReadLine();
int count=0;
for(int i=0;i<4;i++){
for(int j=0;j<4;j++){
if(arr[i,j]==seat){
arr[i,j]="Seat"+i+"-"+j;
display();
count=1;
}
  
}
}
if(count==0)
{
Console.WriteLine("Please Try again...!!!");
}
}
static void Main()
{
string name;
  
   string[,] tem = new string[,]
   {
   {"Seat1-1", "Seat1-2","Seat1-3","Seat1-4"},
   {"Seat2-1","Seat2-2","Seat2-3","Seat2-4"},
   {"Seat3-1","Seat3-3","Seat3-3","Seat3-4"},
   {"Seat4-1","Seat4-2","Seat4-3","Seat4-4"}
   };
   Seat p=new Seat(tem);
p.display();
p.setData();
Console.WriteLine("Do you want to book again(Press 1) or Delete Name(Press 2):");
int ch=Convert.ToInt32(Console.ReadLine());
if(ch==1){
p.display();
p.setData();
}
else if(ch==2){
p.delData();
}

}
}

**************************output***************************************

Seat1-1 Seat1-2 Seat1-3 Seat1-4   
Seat2-1 Seat2-2 Seat2-3 Seat2-4   
Seat3-1 Seat3-3 Seat3-3 Seat3-4   
Seat4-1 Seat4-2 Seat4-3 Seat4-4   
Please enter which seat you want to choose:
Seat1-3   
Please enter Your Name:   
Addix   
Seat1-1 Seat1-2 Addix Seat1-4   
Seat2-1 Seat2-2 Seat2-3 Seat2-4   
Seat3-1 Seat3-3 Seat3-3 Seat3-4   
Seat4-1 Seat4-2 Seat4-3 Seat4-4   
Do you want to book again(Press 1) or Delete Name(Press 2):
2   
Please enter your name to delete the seat:
Addix   
Seat1-1 Seat1-2 Seat0-2 Seat1-4   
Seat2-1 Seat2-2 Seat2-3 Seat2-4   
Seat3-1 Seat3-3 Seat3-3 Seat3-4   
Seat4-1 Seat4-2 Seat4-3 Seat4-4