Question

MAKE SURE YOU TEST THE PROGRAM FISRT. DON'T PUT THE CODE WITHOUT TESTING. MAKE SURE ALL...

MAKE SURE YOU TEST THE PROGRAM FISRT. DON'T PUT THE CODE WITHOUT TESTING.

MAKE SURE ALL THE STEPS ARE FOLLOWED IN CORRECT MANNER

ONLY USE VISUAL STUDIO C# CONSOLE APPLICATION

Use File IO

(NO JAVA CODING)

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.

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*

Allow the user the following options:Add a customer to the seating plan                                                                                            [8 Marks]

Request the customer's name

Display a list of the seats in the venue

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*

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

If no seats are available, inform the user

Remove a customer from the seating plan                                                                               [4 Marks]

Request the customer's name or seat number

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

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]

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

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer: Source code: using System; using System. IO; using System.collections.Generic; using System. Linq: using System.Text;flag l; Console. WriteLine (n return flag: void display (stringl,] seat) int i, ji Console.WriteLine (Available seats); fstring Uname; int row, column, set-l char c column) file .WriteLine (user namee Console.WriteLine (\nEnter user name ) Unvoid remove (int r,int c,stringt, seat) seatr, c static void Main (string[] args) Program p-new Program); stringt, seat new sConsole.WriteLine (3.Exit) Console.WriteLine (Enter choice: ) chConvert.ToInt32 (Console.ReadLine()) switch (ch) case 1:Console.WriteLine (Removed break; file.close ) successfully); case 3 setli breaki Console. ReadKey ()Sample Output: file:///C:/Users/thirumal/documents/visual studio 2010/Projects/Seatreservation/Seatreservation/bin/D... 1.ResAvailable seats harmila 00 0 0 sharm 1 la 0 .Reserue 2.Renove ● Exit Enter choice: Available seats harmila 0 0 0 0 sharmila 0Enter row: nter colunn: nt to add another seat(y or n>: vailable seats harnila 00 0 sameera sameera sharmila 0 .Reserue . RenProgram code:

using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Seatreservation
{

class Program
{

int displayseat(string[,] seat)
{
int i, j,flag=0;
Console.WriteLine("Available seats");
for (i = 0; i < 4; i++)
{
for (j = 0; j < 4; j++)
{
Console.Write(seat[i, j]+" ");
if (seat[i, j] == "0")
flag = 1;
  
}
Console.WriteLine("\n");
}
  
return flag;
}
void display(string[,] seat)
{
int i, j;
Console.WriteLine("Available seats");
for (i = 0; i < 4; i++)
{
for (j = 0; j < 4; j++)
{
Console.Write(seat[i, j] + " ");
  
}
Console.WriteLine("\n");
}
  
}
void adduser(string[,] seat, StreamWriter file)
{
string Uname;
int row, column,set=1;
char c;
  
file.WriteLine("user name row column");
Console.WriteLine("\nEnter user name :");
Uname = Console.ReadLine();
while (set == 1)
{
Console.WriteLine("\nEnter row: ");
row = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("\nEnter column: ");
column = Convert.ToInt32(Console.ReadLine());
seat[row, column] =Uname ;
file.WriteLine(Uname+" "+ row+" " +column);
  
Console.WriteLine("\nwant to add another seat(y or n): ");
c = Convert.ToChar(Console.ReadLine());
if (c == 'n')
{
set = 0;
  
}
}
  
}
void remove(int r,int c,string[,] seat)
{
seat[r, c] = "0";
}
static void Main(string[] args)
{

Program p=new Program();
string[,] seat = new string[4,4];
StreamWriter file = new StreamWriter("../../file1.txt");
int i, j, flag = 0,ch,set=0,r,c ;
for (i = 0; i < 4; i++)
{
for (j = 0; j < 4; j++)
{
seat[i, j] = "0";
}
}
while (set == 0)
{
Console.WriteLine("1.Reserve");
Console.WriteLine("2.Remove");
Console.WriteLine("3.Exit");
Console.WriteLine("Enter choice: ");
ch = Convert.ToInt32(Console.ReadLine());
switch (ch)
{
case 1: flag = p.displayseat(seat);
if (flag == 1)
{
Console.WriteLine("Add user!!");
p.adduser(seat,file);
p.display(seat);
  
}
else
Console.WriteLine("\nSeats are not available");
break;
case 2: Console.WriteLine("Enter seat row number: ");
r = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter seat column number: ");
c = Convert.ToInt32(Console.ReadLine());
p.remove(r, c, seat);
p.display(seat);
Console.WriteLine("Removed successfully");
break;
case 3: set = 1;
file.Close();
break;
}
}
  
Console.ReadKey();
}
}
}

Add a comment
Know the answer?
Add Answer to:
MAKE SURE YOU TEST THE PROGRAM FISRT. DON'T PUT THE CODE WITHOUT TESTING. MAKE SURE ALL...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Program Description: A bus has 28 seats, arranged in 7 rows and 4 columns: This seating...

    Program Description: A bus has 28 seats, arranged in 7 rows and 4 columns: This seating arrangement is mapped, row-wise, to a 1D-array of size 28: 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 0 1 2 3 21 22 23 24 25 Implement a well-structured Java program to enable a user to make and cancel seat reservations for the bus. The program uses Array to store the reservation information: 0...

  • C# WINDOWS FORMS APPLICATION (not CONSOLE APPLICATION ) (Please screenshot window form of this program and...

    C# WINDOWS FORMS APPLICATION (not CONSOLE APPLICATION ) (Please screenshot window form of this program and write code on computer. Thank you very much !) For this week's assignment , create and complete a Windows application for the following question. Airline Reservation System: An airline has just bought a computer for its new reservation system. Develop a new system to assign seats on the new airplane( capacity: 10 seats) Display the following alternatives: "Please type 1 for first class, and...

  • P7.5– A theater seating chart is implemented as a two-dimensional array of ticket prices, like this:...

    P7.5– A theater seating chart is implemented as a two-dimensional array of ticket prices, like this: 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 20 20 20 20 20 20 10 10 10 10 20 20 20 20 20 20 10 10 10 10 20 20 20 20 20 20 10 10 20 20 30 30...

  • The Course Project can be started in Week 7 and is due by 11:59 pm CT...

    The Course Project can be started in Week 7 and is due by 11:59 pm CT Saturday of Week 8. It must follow standard code formatting and have a comment block at the top of the code file with a detailed description of what the program does. Functions must have a comment block with a detailed description of what it does. Pseudocode must be provided in the comment block at the top of the file. This program will allow the...

  • Can you help us!! Thank you! C++ Write a program that can be used by a...

    Can you help us!! Thank you! C++ Write a program that can be used by a small theater to sell tickets for performances. The program should display a screen that shows which seats are available and which are taken. Here is a list of tasks this program must perform • The theater's auditorium has 15 rows, with 30 seats in each row. A two dimensional array can be used to represent the seats. The seats array can be initialized with...

  • A bus has 28 seats, arranged in 7 rows and 4 columns: This seating arrangement is...

    A bus has 28 seats, arranged in 7 rows and 4 columns: This seating arrangement is mapped, row-wise, to a 1D-array of size 28: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 Implement a well-structured C program to enable a user to make and cancel seat reservations for the bus. The program uses a text-file seats.txt to store the reservation...

  • Write a program in C to assign seats of a movie theater (capacity: 200 seats). Your...

    Write a program in C to assign seats of a movie theater (capacity: 200 seats). Your program should display the following menu of alternatives: Please type 1 for "section A, $50/ticket" type 2 for "section B, $70/ticket", and type 3 for "section C, $80/ticket".  If the user types 1, then your program should assign a seat in the A section (seats 1–50). If the user types 2, then your program should assign a seat in the B section (seats 51–100). If...

  • C++ Help please- kind of long. The aim is to implement a seat reservation system for...

    C++ Help please- kind of long. The aim is to implement a seat reservation system for a passenger airplane. We assume a small airplane with 10 rows and 4 seats per row. We assume that the seat chart is initially stored in a file “chartIn.txt” in the following format: 1   A B C D 2   A B C D 3   A B C D 4   A B C D 5   A B C D 6   A B C D 7  ...

  • Program is in C++, program is called airplane reservation. It is suppose to display a screen...

    Program is in C++, program is called airplane reservation. It is suppose to display a screen of seating chart in the format 1 A B C D E F through 10. I had a hard time giving the seats a letter value. It displays a correct screen but when I reserve a new seat the string seats[][] doesn't update to having a X for that seat. Also there is a file for the struct called systemUser.txt it has 4 users...

  • Programming Language: C++ Develop a seat reservation system for your airline. Consider the following airline seating...

    Programming Language: C++ Develop a seat reservation system for your airline. Consider the following airline seating pattern: A         1          2          3          4          5          6          7          8          9          ……    100 B         1          2          3          4          5          6          7          8          9          ……    100 AISLE C         1          2          3          4          5          6          7          8          9          ……    100 D         1          2          3          4          5          6          7          8          9          ……    100 Either use 2D STL array (array that contains array) or 4 single dimensional STL arrays of size 100. Write a program to display a menu to the user with the options to reserve a seat of choice, reserve a window seat, reserve an aile seat, reserve a seat (any available), withdraw reservation, update reservation (change seat) and display...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT