Write a program that can be used to assign seats for a commercial airplane. The airplane has 13 rows, with six seats in each row. Rows 1 and 2 are first class, rows 3 through 7 are business class, and rows 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 seatSo far the code I have is ... now can I go about finishing to retreive the user input ? (This is for C++)#include #include using namespace std;int main(){ int r, c; char seat_resvr; char tic_type; char availability[13][6], reserved[2]; int row_num, col_num; char seats; cout << "A program that lets you choose your seating arrangement on an airplane"; cout << endl; char A[13][6]; for (int r = 0; r < 13; r++) { for (int c = 0; c < 6; c++) A[r][c] = '*'; } /*int row, seat; cin >> row >> seat; A[row - 1][seat - 1] = 'X';*/ cout << " A B C D E F" << endl; for (int r = 0; r < 13; r++) { cout << "Row" << setw(3) << r + 1 << " "; for (int c = 0; c < 6; c++) cout << A[r][c] << ' '; 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'; return 0;}

Answers

Answer 1
Answer:

Answer:

See explaination

Explanation:

#include <iostream>

#include <string>

#include <stdio.h>

#include <cst dlib>

using namespace st d;

int main(int argc, char *argv[])

{

int airplane[13][6];

char airchar[13][6];

string ticket;

int row[2];

char seat;

//--------------------------------------------

for(int i = 0; i < 13; i++)

{

for(int j = 0; j < 6; j++)

{

airchar[i][j] = '*';

airplane[i][j] = 0;

}

}

//--------------------------------------------

for(;;)

{

cout<<"Rows 1 and 2 are first class (F C)"<<endl;

cout<<"Rows 3 through 7 are business class (B C)"<<endl;

cout<<"Rows 8 through 13 are economy class (E C)"<<endl;

cout<<endl;

cout<<"* - Available"<<endl;

cout<<"X - Occupied"<<endl;

cout<<endl;

cout<<" \t A\t B\t C\t D\t E\t F"<<endl;

cout<<"Row 1\t"<<airchar[0][0]<<"\t"<<airchar[0][1]<<"\t"

<<airchar[0][2]<<"\t"<<airchar[0][3]<<"\t"<<airchar[0][4]<<"\t"

<<airchar[0][5]<<endl;

cout<<"Row 2\t"<<airchar[1][0]<<"\t"<<airchar[1][1]<<"\t"

<<airchar[1][2]<<"\t"<<airchar[1][3]<<"\t"<<airchar[1][4]<<"\t"

<<airchar[1][5]<<endl;

cout<<"Row 3\t"<<airchar[2][0]<<"\t"<<airchar[2][1]<<"\t"

<<airchar[2][2]<<"\t"<<airchar[2][3]<<"\t"<<airchar[2][4]<<"\t"

<<airchar[2][5]<<endl;

cout<<"Row 4\t"<<airchar[3][0]<<"\t"<<airchar[3][1]<<"\t"

<<airchar[3][2]<<"\t"<<airchar[3][3]<<"\t"<<airchar[3][4]<<"\t"

<<airchar[3][5]<<endl;

cout<<"Row 5\t"<<airchar[4][0]<<"\t"<<airchar[4][1]<<"\t"

<<airchar[4][2]<<"\t"<<airchar[4][3]<<"\t"<<airchar[4][4]<<"\t"

<<airchar[4][5]<<endl;

cout<<"Row 6\t"<<airchar[5][0]<<"\t"<<airchar[5][1]<<"\t"

<<airchar[5][2]<<"\t"<<airchar[5][3]<<"\t"<<airchar[5][4]<<"\t"

<<airchar[5][5]<<endl;

cout<<"Row 7\t"<<airchar[6][0]<<"\t"<<airchar[6][1]<<"\t"

<<airchar[6][2]<<"\t"<<airchar[6][3]<<"\t"<<airchar[6][4]<<"\t"

<<airchar[6][5]<<endl;

cout<<"Row 8\t"<<airchar[7][0]<<"\t"<<airchar[7][1]<<"\t"

<<airchar[7][2]<<"\t"<<airchar[7][3]<<"\t"<<airchar[7][4]<<"\t"

<<airchar[7][5]<<endl;

cout<<"Row 9\t"<<airchar[8][0]<<"\t"<<airchar[8][1]<<"\t"

<<airchar[8][2]<<"\t"<<airchar[8][3]<<"\t"<<airchar[8][4]<<"\t"

<<airchar[8][5]<<endl;

cout<<"Row 10\t"<<airchar[9][0]<<"\t"<<airchar[9][1]<<"\t"

<<airchar[9][2]<<"\t"<<airchar[9][3]<<"\t"<<airchar[9][4]<<"\t"

<<airchar[9][5]<<endl;

cout<<"Row 11\t"<<airchar[10][0]<<"\t"<<airchar[10][1]<<"\t"

<<airchar[10][2]<<"\t"<<airchar[10][3]<<"\t"<<airchar[10][4]<<"\t"

<<airchar[10][5]<<endl;

cout<<"Row 12\t"<<airchar[11][0]<<"\t"<<airchar[11][1]<<"\t"

<<airchar[11][2]<<"\t"<<airchar[11][3]<<"\t"<<airchar[11][4]<<"\t"

<<airchar[11][5]<<endl;

cout<<"Row 13\t"<<airchar[12][0]<<"\t"<<airchar[12][1]<<"\t"

<<airchar[12][2]<<"\t"<<airchar[12][3]<<"\t"<<airchar[12][4]<<"\t"

<<airchar[12][5]<<endl;

cout<<endl;

cout<<"Enter Ticket type (F C, B C, or E C): ";

cin>>ticket;

cout<<"Desired Row: ";

cin>>row[0];

cout<<"Desired seat (A,B,C,D,E or F): ";

cin>>seat;

switch(seat)

{

case 'A':

case 'a':

row[0] = row[0] - 1;

row[1] = 1;

row[1] = row[1] - 1;

break;

case 'B':

case 'b':

row[0] = row[0] - 1;

row[1] = 2;

row[1] = row[1] - 1;

break;

case 'C':

case 'c':

row[0] = row[0] - 1;

row[1] = 3;

row[1] = row[1] - 1;

break;

case 'D':

case 'd':

row[0] = row[0] - 1;

row[1] = 4;

row[1] = row[1] - 1;

break;

case 'E':

case 'e':

row[0] = row[0] - 1;

row[1] = 5;

row[1] = row[1] - 1;

break;

case 'F':

case 'f':

row[0] = row[0] - 1;

row[1] = 6;

row[1] = row[1] - 1;

break;

}

if(ticket == "F C")

{

if(row[0]+1 == 1 || row[0]+1 == 2)

{

if(airplane[row[0]][row[1]] == 0)

{

airplane[row[0]][row[1]] = 1;

airchar[row[0]][row[1]] = 'X';

}

else if(airplane[row[0]][row[1]] == 1)

{

cout<<"Message: Seat "<<row[0] + 1<<seat<<" is already occupied"<<endl;

system("Pause");

}

}

else

{

cout<<"Wrong Class"<<endl;

system("Pause");

system("cls");

continue;

}

}

else if(ticket == "B C")

{

if(row[0]+1 == 3 || row[0]+1 == 4 || row[0]+1 == 5

|| row[0]+1 == 6|| row[0]+1 == 7)

{

if(airplane[row[0]][row[1]] == 0)

{

airplane[row[0]][row[1]] = 1;

airchar[row[0]][row[1]] = 'X';

}

else if(airplane[row[0]][row[1]] == 1)

{

cout<<"Message: Seat "<<row[0] + 1<<seat<<" is already occupied"<<endl;

system("Pause");

}

}

else

{

cout<<"Wrong Class"<<endl;

system("Pause");

system("cls");

continue;

}

}

else if(ticket == "E C")

{

if(row[0]+1 == 8 || row[0]+1 == 9 || row[0]+1 == 10

|| row[0]+1 == 11|| row[0]+1 == 12|| row[0]+1 == 13)

{

if(airplane[row[0]][row[1]] == 0)

{

airplane[row[0]][row[1]] = 1;

airchar[row[0]][row[1]] = 'X';

}

else if(airplane[row[0]][row[1]] == 1)

{

cout<<"Message: Seat "<<row[0] + 1<<seat<<" is already occupied"<<endl;

system("Pause");

}

}

else

{

cout<<"Wrong Class"<<endl;

system("Pause");

system("cls");

continue;

}

}

row[0] = 0;

row[1] = 0;

system("cls");

}

return 0;

}


Related Questions

Consider the following two code segments, which are both intended to determine the longest of the three strings "pea", "pear", and "pearl" that occur in String str. For example, if str has the value "the pear in the bowl", the code segments should both print "pear" and if str has the value "the pea and the pearl", the code segments should both print "pearl". Assume that str contains at least one instance of "pea".I.if (str.indexOf("pea") >= 0){System.out.println("pea");}else if (str.indexOf("pear") >= 0){System.out.println("pear");}else if (str.indexOf("pearl") >= 0){System.out.println("pearl");}II.if (str.indexOf("pearl") >= 0){System.out.println("pearl");}else if (str.indexOf("pear") >= 0){System.out.println("pear");}else if (str.indexOf("pea") >= 0){System.out.println("pea");}Which of the following best describes the output produced by code segment I and code segment II?Both code segment I and code segment II produce correct output for all values of str.Neither code segment I nor code segment II produce correct output for all values of str.Code segment II produces correct output for all values of str, but code segment I produces correct output only for values of str that contain "pear" but not "pearl".Code segment II produces correct output for all values of str, but code segment I produces correct output only for values of str that contain "pearl".Code segment II produces correct output for all values of str, but code segment I produces correct output only for values of str that contain "pea" but not "pear".
)Which of following can be thrown using the throwstatement?? Error? Throwable? Exception? RuntimeException? All of Given? None of given
List two reasons why “buying a computer is no easy task” ?
Which of the following people was a member of FFA?O Kenny ChesneyO Tim McGrawO Alan JacksonO Billy Currington
Initialize a list. ACTIVITY Initialize the list short.names with strings 'Gus', Bob, and 'Ann'. Sample output for the given program Gus Bob Ann 1 short_names- Your solution goes here 2 # print names 4 print(short_names[0])

The study of a current business and information system application and the definition of user requirements and priorities for a new or improved information system are part of which phase? (Points : 2) Problem analysis phaseScope definition phase
Requirements analysis phase
Decision analysis phase
None of the above

Answers

Answer: Problem analysis phase

Explanation: Problem phase analysis is the mechanism that helps in studying the problems and issue that occur in the application and system of any business organization.It helps in identification of the reason and consequences of the detected problems.The requirements of user and resources to accomplish business system is also analyzed.

Other options are incorrect because scope definition phase is used for identification of the boundaries of any project regarding opportunities and issue in business .

Requirement analysis phase is used for gathering the need of the user and the condition requirement to fulfill a project. Decision phase analysis is done to bring out the best possible solution for any project. Thus, the correct option is problem analysis phase.

To define constructors and member functions outside of a class's original scope, the operator can be used.

Answers

Answer: Scope resolution operator(::)

Explanation: A member function and the constructor can be called within the function easily but for the execution of the these components outside the class , a special operator is required to call the functions. The scope resolution operator(::) preceding with the name of class is thus used for defining of the function outside class.This operator maintains the cope of the function and constructor outside the class.

Which of the following statements is NOT true regarding the Security Configuration and Analysis (SCA) tool?a. It evaluates the current security state of computers in accordance with Microsoft security recommendations.
b. It allows an administrator to analyze a computer and compare its configuration settings with a baseline.
c. It can apply a baseline to force current computer settings to match the settings defined in the baseline.
d. It uses security templates to store the settings that make up baselines.

Answers

Answer: a. It evaluates the current security state of computers in accordance with Microsoft security recommendations

Explanation:

The Security Configuration and Analysis tool allows the configuration of local computers through the application of the settings in a security template to the local policy.

This allows an administrator to analyze a computer and compare its configuration settings with a baseline. The Security Configuration and Analysis (SCA) tool also uses security templates to store the settings that make up baselines.

Therefore, based on the options given, the correct option is A as the SCA tool doesn't evaluate the current security state of computers in accordance with Microsoft security recommendations.

What is the magnitude of the largest positive value you can place in a bool? a char? an int? a float?

Answers

Answer:

A bool can hold only true or false values.

A char can hold maximum 65535 characters.

An int can hold maximum positive value of 2,147,483,647.

A float can hold maximum positive value of 3.4 x 10^{38}.

Explanation:

Primitive data types in Java language can be categorized into boolean and numeric data types.

Numeric can be divided further into floating point and integral type. Floating data type includes float and double values while and integral data type which consists of char, int, short, long and byte data types.

Every data type has a range of values it can hold, i.e., every data type has a minimum and maximum predefined value which it is allowed to hold. The intermediate values fall in the range of that particular data type.

Any value outside the range of that particular data type will not compile and an error message will be displayed.

The data types commonly used in programming are boolean, char, int and float.

A boolean variable can have only two values, true or false.

A char variable can hold from 0 to 65535 characters. Maximum, 65535 characters are allowed in a character variable. At the minimum, a char variable will have no characters or it will be a null char variable, having no value.

An int variable has the range from minimum -2^{31} to maximum 2^{31} – 1. Hence, the maximum positive value an int variable can hold is (2^{31}) – 1.

A float variable can hold minimum value of 1.4 x 10^{-45} and maximum positive value of 3.4 x 10^{38}.

The above description relates to the data types and their respective range of values in Java language.

The values for boolean variable remain the same across all programming languages.

The range of values for char, int and float data types are different in other languages.

Select the correct answer. Which decimal number is equivalent to this binary number? 11111011

Answers

The decimal number which is equivalent to binary number 11111011 is 251.

Binary numbers are base-2 numbers, which means they are composed of only two digits: 0 and 1.

Each digit in a binarynumber represents a power of 2, starting from the rightmost digit.

The rightmost digit represents 2⁰ (which is 1), the next digit represents 2¹(which is 2), the next represents 2² (which is 4), and so on.

Given the binary number 11111011:

1 × 2⁷ + 1 × 2⁶ + 1 × 2⁵ + 1 × 2⁴ + 1 × 2³ + 0 × 2² + 1 × 2¹ + 1 × 2⁰

Simplifying each term:

128 + 64 + 32 + 16 + 8 + 0 + 2 + 1

= 251

Hence, 251 is the decimalnumber which is equivalent to binary number 11111011.

To learn more on Binary numbers click here:

brainly.com/question/31102086

#SPJ3

Answer:

251

Explanation:

Create a query that will list all technician names, employee numbers, and year hired in order by year hired (Newest to Oldest).

Answers

Answer:

SELECT TECHNAME, EMPNUM, YEAR FROM EMPLOYEE ORDER BY YEAR DESC

Explanation:

The table definition is not given;

However, I'll make the following assumptions

Table Name:

Employee

Columns:

Technician name will be represented with Techname

Employee number will be represented with Empnum

Year Hired will be represented with Year

Having said that; the sql code is as follows:

SELECT TECHNAME, EMPNUM, YEAR FROM EMPLOYEE ORDER BY YEAR DESC

The newest year hired will be the largest of the years;

Take for instance:

An employee hired in 2020 is new compared to an employee hired in 2019

This implies that the year has to be sorted in descending order to maintain the from newest to oldest.

Other Questions