0

please can you generate the codes in C#(Programming in .Net Environment
Write a program that can be used to assign seat for a commercial airplane. The airplane has 13 rows, with six seats in each row, Row 1 and 2 are first class, row 3 through 7 are business class, and row 8 through 13 are economy class. Your program must prompt the user to enter the following information.

a. Ticket type (first class, business class, or economy class)

b. Desired seat

c. Output seating plan in the following form:

3
Contributors
6
Replies
28
Views
4 Months
Discussion Span
Last Post by ddanbe
0

First you write code.
If you have problems with it.
Post code and questions here.
We will try to help.

0

can you convert my codes C# Ffor me beacause is hard for me in here ,this is c++ and i want it in c#

header declaration

include <iostream>

include <cctype>

using namespace std;

//function declaration

//main function
int main()

{header declaration
#include <iostream>
#include <cctype>
using namespace std;

//function declaration

//main function
int main()

header declaration
#include <iostream>
#include <cctype>
using namespace std;

//function declaration

//main function
int main()
{
    int i, j;
    char seat_resvr;
    char tic_type;
    char availability [13][6], reserved[2];
    int row_num, col_num;
    char seats;

    cout << "This program assigns seats for a commercial airplane." << endl << "The current seat assignment is as follows." << endl << endl << "\t\tA\tB\tC\tD\tE\tF" << endl;

    for (i=0; i<13; i++){
        cout << "Row " << i+1 << "\t\t";
        for (j=0; j<6; j++){
            cout << "*" << "\t";
        }
        cout << endl;
    }

    cout << endl << "* -- available seat" << endl 
        << "X -- occupied seat" << endl << endl
        << "Rows 1 and 2 are for first class passengers."<< endl
        <<"Rows 3 through 7 are for business class passengers."<< endl
        <<"Rows 8 through 13 are for economy class passengers."<< endl;
    cout << "To reserve a seat enter Y/y (Yes), N/n(No):" << endl;
    cin >> seat_resvr;
    reserved [2] = 'X';

    if(toupper(seat_resvr) == 'Y')
    {
        fflush (stdin);
        cout << "Enter ticket type: F/f (first class); (B/b) (business class); E/e (economy class) :";
        cin >> tic_type;

        if (toupper(tic_type)=='F')
        {
            cout << endl << endl 
                << "Enter Row number 1 \– 2: ";
            cin >> row_num;
            i = row_num;
            cout << endl << endl
                << "Enter Seats A - F: ";
            cin >> seats;
            switch (toupper(seats))
            {
            case 'A':
                col_num = 0;
                break;
            case 'B':
                col_num = 1;
                break;
            case 'C':
                col_num = 2;
                break;
            case 'D':
                col_num = 3;
                break;
            case 'E':
                col_num = 4;
                break;
            case 'F':
                col_num = 5;
                break;
            default:
                break;
            }
            j = col_num;
            availability [i][j] = reserved[2];

        }
    }
    cout << "The seats is reserved for you." << endl << endl 
        << "\t\tA\tB\tC\tD\tE\tF" << endl;

    for (i=0; i<13; i++){
        cout << "Row " << i+1 << "\t\t";
        for (j=0; j<6; j++){
            cout << availability << "\t";
        }
        cout << endl;
    }

    return 0;
}

{
    int i, j;
    char seat_resvr;
    char tic_type;
    char availability [13][6], reserved[2];
    int row_num, col_num;
    char seats;

    cout << "This program assigns seats for a commercial airplane." << endl << "The current seat assignment is as follows." << endl << endl << "\t\tA\tB\tC\tD\tE\tF" << endl;

    for (i=0; i<13; i++){
        cout << "Row " << i+1 << "\t\t";
        for (j=0; j<6; j++){
            cout << "*" << "\t";
        }
        cout << endl;
    }

    cout << endl << "* -- available seat" << endl 
        << "X -- occupied seat" << endl << endl
        << "Rows 1 and 2 are for first class passengers."<< endl
        <<"Rows 3 through 7 are for business class passengers."<< endl
        <<"Rows 8 through 13 are for economy class passengers."<< endl;
    cout << "To reserve a seat enter Y/y (Yes), N/n(No):" << endl;
    cin >> seat_resvr;
    reserved [2] = 'X';

    if(toupper(seat_resvr) == 'Y')
    {
        fflush (stdin);
        cout << "Enter ticket type: F/f (first class); (B/b) (business class); E/e (economy class) :";
        cin >> tic_type;

        if (toupper(tic_type)=='F')
        {
            cout << endl << endl 
                << "Enter Row number 1 \– 2: ";
            cin >> row_num;
            i = row_num;
            cout << endl << endl
                << "Enter Seats A - F: ";
            cin >> seats;
            switch (toupper(seats))
            {
            case 'A':
                col_num = 0;
                break;
            case 'B':
                col_num = 1;
                break;
            case 'C':
                col_num = 2;
                break;
            case 'D':
                col_num = 3;
                break;
            case 'E':
                col_num = 4;
                break;
            case 'F':
                col_num = 5;
                break;
            default:
                break;
            }
            j = col_num;
            availability [i][j] = reserved[2];

        }
    }
    cout << "The seats is reserved for you." << endl << endl 
        << "\t\tA\tB\tC\tD\tE\tF" << endl;

    for (i=0; i<13; i++){
        cout << "Row " << i+1 << "\t\t";
        for (j=0; j<6; j++){
            cout << availability << "\t";
        }
        cout << endl;
    }

    return 0;
}

int i, j;
char seat_resvr;
char tic_type;
char availability [13][6], reserved[2];
int row_num, col_num;
char seats;

cout << "This program assigns seats for a commercial airplane." << endl << "The current seat assignment is as follows." << endl << endl << "\t\tA\tB\tC\tD\tE\tF" << endl;

for (i=0; i<13; i++){
    cout << "Row " << i+1 << "\t\t";
    for (j=0; j<6; j++){
        cout << "*" << "\t";
    }
    cout << endl;
}

cout << endl << "* -- available seat" << endl 
    << "X -- occupied seat" << endl << endl
    << "Rows 1 and 2 are for first class passengers."<< endl
    <<"Rows 3 through 7 are for business class passengers."<< endl
    <<"Rows 8 through 13 are for economy class passengers."<< endl;
cout << "To reserve a seat enter Y/y (Yes), N/n(No):" << endl;
cin >> seat_resvr;
reserved [2] = 'X';

if(toupper(seat_resvr) == 'Y')
{
    fflush (stdin);
    cout << "Enter ticket type: F/f (first class); (B/b) (business class); E/e (economy class) :";
    cin >> tic_type;

    if (toupper(tic_type)=='F')
    {
        cout << endl << endl 
            << "Enter Row number 1 \– 2: ";
        cin >> row_num;
        i = row_num;
        cout << endl << endl
            << "Enter Seats A - F: ";
        cin >> seats;
        switch (toupper(seats))
        {
        case 'A':
            col_num = 0;
            break;
        case 'B':
            col_num = 1;
            break;
        case 'C':
            col_num = 2;
            break;
        case 'D':
            col_num = 3;
            break;
        case 'E':
            col_num = 4;
            break;
        case 'F':
            col_num = 5;
            break;
        default:
            break;
        }
        j = col_num;
        availability [i][j] = reserved[2];

    }
}
cout << "The seats is reserved for you." << endl << endl 
    << "\t\tA\tB\tC\tD\tE\tF" << endl;

for (i=0; i<13; i++){
    cout << "Row " << i+1 << "\t\t";
    for (j=0; j<6; j++){
        cout << availability << "\t";
    }
    cout << endl;
}

return 0;
2

No need to shout!

Let me explain:
at DaniWeb we help people who are learning or having a problem. We try to help by teaching them what they need to know to solve their own problem, and others like it in the future.
There's no way we will ever just do someone's work for them because they are to lazy or cannot be bothered to make some effort themselves.

So get on to Google, find some learning resources, read/study, then try to do this yourself. If/when you get stuck come back here, explain what you have done and what's stopping you, and someone will help.

Votes + Comments
Well said
0

As I'm in a good mood today and to put you on the way I give you a translation of the first few lines of C++ into C#

using System;

namespace ConsoleAppDaniweb
{
    class Program
    {
        static void Main(string[] args)
        {
            int i, j;
            char seat_resvr;
            char tic_type;
            char[,] availability = new char[13,6];
            int row_num, col_num;
            char seats;
            Console.WriteLine("This program assigns seats for a commercial airplane.");
            Console.WriteLine("The current seat assignment is as follows.");
            Console.WriteLine();
            Console.WriteLine("\t\tA\tB\tC\tD\tE\tF");

            for (i = 0; i < 13; i++)
            {
                Console.WriteLine("Row {0} {1}" ,i + 1 ,"\t\t");
                for (j = 0; j < 6; j++)
                {
                    Console.WriteLine("* \t");
                }
                Console.WriteLine();
            }

            Console.ReadKey();
        }
    }
}
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.